This project contains TestNG test suites for automating certain functionalities of Flipkart.com. It includes tests for validating Sort Functionality and the Add to Cart functionality.
SortProducts.java
: Contains the test cases for validating the Product Sorting functionality.AddToCart.java
: Contains the test cases for validating the Add to Cart functionality.test_data.xlsx
: Stores test data like search terms, sort options, and number of pages.
This test case validates that products are displayed in the correct order after applying a sort filter (e.g., "Price - Low to High").
- Steps:
- Open Flipkart.com.
- Search for a product (e.g., "shoes").
- Apply a sort filter (e.g., "Price - Low to High").
- Validate that the prices of the displayed products (up to a specified page limit) are in ascending order.
This test case validates the process of adding products to the cart and verifying the cart contents.
- Steps:
- Open Flipkart.com.
- Search for a product.
- Apply a sort filter.
- Click on 2nd product and add to cart, then click on 3rd product and add to cart
- Verify that the correct products and prices are displayed in the cart.
- Verify the total price in the cart.
test_data.xlsx
: Contains basic test data like search keywords, sortByParam and page.
Approximately 8 hours were spent on developing these test suites, including:
- Setting up the project and environment.
- Writing the test cases (including handling multiple windows and dynamic content).
- Implementing data-driven testing using properties files and Excel.
- Debugging and resolving issues with window handling and element locators.
- Writing the ReadXlsData utility class.
- Creating the testng.xml configuration.
- Documenting the project in this README.
- Java Development Kit (JDK) 8 or higher
- Maven
- A suitable IDE (IntelliJ IDEA, Eclipse, etc.) is recommended.
- Chrome browser installed.
- Clone the project repository.
- Import the project into your IDE as a Maven project.
- Locate the testng.xml file in the project root.
- Right-click on the testng.xml file in your IDE.
- Select "Run As" -> "TestNG Suite."