eCommerce sites are gaining in popularity with each day. With the increase in demand, it has become extremely important to ensure the availability of each and every feature on these sites. If the site is multi-linguistic, then testing it manually becomes even more tedious. Testing on various browsers and for responsiveness adds to the work further.
In this blog, we will be discussing the most common and important features of these sites which can be automated. Functional regression tests become necessary when the site starts growing larger with each new function being added to the site. In this blog, we will consider http://automationpractice.com/index.php our demo test site.
Functional scenarios that can be automated for any eCommerce site are as below:
Checkout using various delivery types & payment options
1. Checkout is the most important feature of any eCommerce site, since it directly impacts the business of the site. Hence, it is extremely important to automate all possible combinations of delivery type (Home Delivery, Collect from Store) and payment types (Cash on Delivery, Pay through Card, etc.)
2. Ensure that a test is written for each combination on all supported languages too.
3. Ensure that checkout works for guests, authenticated users and returning customers (someone who logs in after populating the cart).
4. While checking out, write tests to ensure that the user is able to select from multiple addresses, if available. Also, the user should be able to add a new address while checking out, and check out using the newly added address.
Search is the next most important feature of these sites, because it lets users quickly find what they are looking for:
1. Ensure the test verifies that the search term is present in any of the indexed fields in all the search results displayed. Indexing can be done on any field, either the title, small description, long description, or all of them. Gherkin statements for search would be as below:
Below is a small piece of code that validates whether either of the search terms is present in the title of the results displayed:
2. Users should be able to narrow down their search results using the sorting options. Ensure tests are written to test all types of sorting options. Verify whether all the available filters are working as expected. The Gherkin scenario would be similar to the one below:
The sorting function below can be used to check low and high price order too. The code to check all sorts of sorting options is as below:
NOTE: The sorting function above handles any special characters and uppercase characters to give appropriate results.
3. Ensure the user is able to search terms, add items to the cart and complete the checkout journey. In this condition, you would have to write a script that clicks on the product that is in stock and then adds it to the cart.
4. Lastly, ensure the user is able to search for terms in the language of the site. Search results displayed should also be in the same language and not the default one, for example, say English.
My account section: For signed up users
1. User should be able to view and update account details like address, contact number, etc.
2. User should be able to view past orders.
3. User should be able to sort orders based on the order status.
Products listing page
1. Ensure filters and sorting options are displayed and functioning as expected.
2. Some sites present the option of adding products to the cart from the listing page when the user hovers over a product. Ensure that the user cannot add out-of-stock products to cart. The Gherkin syntax and the corresponding code snippet would look like this:
Product display page
1. Write scripts to select quantity, select available size and color, and then add to cart.
2. Verify logged in user is able to add the product to wishlist and add review comments.
3. Verify adding to wishlist and writing review comments is not available for Guests, and the user is prompted to login upon clicking those links.
4. Ensure all the links open and point to their corresponding target pages.
1. Verify whether all the added products are visible on the cart page.
2. For each product, verify whether description, correct quantity and unit price is displayed.
3. Verify whether user is able to add, delete and update products from the cart page.
Order confirmation page
1. Verify the confirmation message is displayed along with an order number.
2. Verify all the products added to the cart with the selected quantity are displayed on order confirmation.
3. Verify the address is displayed correctly.
4. Verify links like ‘Continue shopping’ and ‘Proceed to checkout’ work as expected.
1. Verify user can apply a promo code and the discounted value is reflected in the total cart value.
2. Verify auto promotions are applied without applying any promo code and when the conditions are met.
Sample code to check “buy x and get y free” would be as below:
1. Verify user subscription works as expected. You might want to write a function to generate a random email so that the test passes on every run. Below is the piece of code to generate a random email every time:
2. Verify breadcrumbs throughout the site.
3. Verify header and footer consistency throughout the site.
4. Ensure negative scenarios are covered throughout the site.
5. Verify all the social media links are functioning throughout the site, like entering incorrect card details, subscribing with a pre-subscribed email ID, trying to log in with an incorrect email ID, etc.
6. Verify user can select a value from the autocomplete results. Below is a code snippet to select the first value from autocomplete from the search field. This function can be used to test autocomplete throughout the site for any field by changing the parameters:
If you found this helpful, or if you have any questions, let us know in the comments below!
Shweta Sharma, Director of Quality Engineering Services
When Shweta isn't at work, she's either on a family road trip across the country or she's dancing with her kids—it's a great combination.