Ecommerce, shopping carts, and the Java classes and events implementation bug
Fun fact about the phrase shopping cart: it’s an American English term. In the United Kingdom, the thing you push around in a grocery store is a trolley. The smaller version you carry around is called a basket in both countries. Online in the UK, ecommerce sites tend to use shopping basket instead of shopping cart. For example, if you look at the Amazon.com site you’ll see “cart”. If you visit Amazon.co.uk, you’ll put items in a “basket”. Regardless of terminology, the functionality is the same. What happens when a user can not remove an item from their shopping cart during an online purchase?
This post is part of a series on the test IO blog about real bugs that our testers have found during test cycles. In each post, we explore the details of the issue, explain its impact, and discuss what software teams can do to avoid similar problems.
There are three types of ecommerce software; open source where the user hosts the software with a web hosting service. Licensed software where the user owns the license and can host wherever they’d like as long as requirements are met. Hosted software is hosted by a service provider, and users pay a monthly or yearly fee. No matter the software model, if you’ve chosen ecommerce software that uses Java on the backend, all of these options share a common event and classes: ShoppingCartActivity, ShoppingCartEntry, and removeButton (OnClick). This event and these classes reference important entities of the users’ online shopping experience, allowing them to interact with items in the shopping cart successfully.
For our bug of the week, we’re taking a look at an ecommerce site that is preventing users from removing items in a cart once they’ve added them.
While testing an e-commerce site, one of our testers found a bug during functional testing by attempting to remove items present in the shopping cart. First the tester added the items. In a separate step, the tester tried to remove those items. On the main screen, the cart showed that there were no items.. However, when the tester went to the actual cart, they saw that the items did not delete.
The bug was initially discovered on Apple iPhone 6+ iOS 11.1. However, it ended up being reproducible on multiple devices and versions of iOS.
This bug highlights the importance of properly implementing your shopping cart behavior on the backend. You must ensure that the ShoppingCartActivity, ShoppingCartEntry and removeButton (onClick) are set up properly. If you’re using Java, the ShoppingCartActivity.java and ShoppingCartEntry.java classes when you remove an item from the ShoppingCartActivity should write back to the ShoppingCartEntry to remove the items. Once those two classes are properly implemented, set up removeButton (onClick) in your ProductAdapter class to ensure that the selected items are removed as expected.
In this case, the app may have not removed the items because the classes were set up improperly or the onClick event was not properly implemented. So whether you are a front-end or backend developer being able to understand both sides of the shopping cart process is vital for the success of the site.