Shopping Cart Validation

Recently I had the task to ensure a mock shopping cart app on the web was working correctly. I decided to play with the darn thing to gain insight on all the things I needed to check. At first glance all seemed well. I added items to my cart. The total amount at the bottom seemed to be incrementing correctly. Then I found some disturbing behavior.

When I removed an item from my cart, it did not always accurately decrease my total price. It did work sometimes. But it did not work most of the time. There was also some weird errors when I removed the last item in the cart. I wanted to go further. I wanted to assist the developer in figuring out what was going wrong.

Initially the incorrect total price seemed random. Then I started calculating the amount it would decrement. Although it was not the amount of the item I removed from the cart, it would decrement by the sales price of some other items in the store. I found that the error would be predictable when I removed items from certain positions in my cart list. Those were the details that let the developer hone in on the exact problem. The cart was implemented in JavaScript. Multiple variables were used in the code. However some of them were supposed to be the same variable. The real lesson from this is that a tester can shine some great light into the nature of bugs. This can help get the bugs resolved faster.