This project contains automated test cases for the Amazon.com website, focusing on web-based functionalities using Selenium and TestNG.
If you don't have the following pre-requisites, follow the steps under the Test Execution in Docker Container section:
- Java 8 or higher
- Maven 7.4.2 or higher
- Chrome/Firefox browser close to the latest version
To run the tests in a Docker container, follow the steps below. If you prefer running tests locally, install the pre-requisites mentioned above and skip this section.
- Open a terminal and navigate to the project directory.
- Use this command to build the docker image , if you're running the testcase in firefox browser
docker build -f Dockerfile-firefox -t <image-name> . - Use this command to build the docker image , if you're running the testcase in chrome browser
docker build -f Dockerfile-chrome -t <image-name> . - Run
docker run -d --name <container-name> <image-name>to start the container - Run
docker exec -it <container-name> /bin/bashto enter the container - Run
mvn clean test -DBrowser=<Chrome or Firefox> -DBrowserMode=“Headless”to execute the tests
- Set
Amazon.xmlas test suite / select a specific test class in Run/Debug Configuration - Open the Edit Configuration
- Open
Listenerstab and enableUse default reporters - Input the following command in VM options:
-ea
-DBrowser=
-DBrowserMode=
- Save configuration and run test
Example:
-ea
-DBrowser="Chrome"
-DBrowserMode="nonHeadless"
- Open a terminal & navigate to the project directory
- Run the following command:
mvn clean test -DBrowser="Chrome" -DBrowserMode="nonHeadless"
Once execution completed for local, the reports can be found in the target/extent-reports/index.html file.
To run github action visit the action tab and run the automation action. Add value for email and browser and run the action. After the action is completed an email would be sent to the email id shared during the previous step which will have the link to the report. The report is hosted using github actions
This project utilizes Selenium for browser automation, TestNG for test case management, and Maven for build and dependency management. Below is a brief overview:
-
Selenium: A powerful tool for automating web browsers, Selenium allows you to interact with web elements, perform actions, and verify results as part of your automated test cases.
-
TestNG: TestNG is a testing framework inspired by JUnit and NUnit, designed to simplify a broad range of testing needs, from unit testing to integration testing. It provides features like parallel execution, dependency testing, and test configuration.
-
Maven: Maven is a build automation tool used primarily for Java projects. It helps manage project dependencies, build processes, and project documentation, ensuring consistent builds across environments.
If you are new to these technologies or want to deepen your understanding, here are some useful resources:
###Selenium WebDriver:
###TestNG:
###Maven:
These resources should provide you with a solid foundation to get started or advance your skills in test automation with Selenium, TestNG, and Maven.