Created an end-to-end test automation framework for the SauceDemo eCommerce website using Selenium WebDriver and TestNG. The framework follows the Page Object Model (POM) for clean, maintainable code and automates key scenarios such as login, select random products, check products total price, cart management, and checkout.
This framework is designed for robust automation testing using Java. It includes:
- Selenium for browser automation
- JUnit and TestNG for structured test management
- Allure Reporting for insightful test reports
- Error Screenshots and more to streamline testing!
- Create a Maven project as usual or set it up from scratch.
- Add the provided dependencies and plugins in your
pom.xmlfile.
- Go to
src/test/javaand create these folders:pagesutilitiestests
- Option 1: Import each file manually into the corresponding folders.
- Option 2: Download the complete
src/test/javafolder and replace it in your project.
- A
driversfolder is included with Chrome, Edge, and Firefox drivers. - Set the driver path in
BaseTest.javaas shown below:System.setProperty("webdriver.chrome.driver", "drivers/chromedriver.exe");
- Or, if using Selenium 4+, use:
WebDriverManager.chromedriver().setup();
- Download
testing.xmland place it in your project directory to manage test execution.
- Save your project and run it. The
allure-reportandscreenshotfolders will be generated automatically during test execution.
- Run the following command to serve the Allure report:
allure serve <path_to_allure_results>
- Alternatively, navigate to the
allure-reportfolder in your file explorer, open a command prompt from that location, and then use:allure serve
Enjoy using the SuccessDemo Test Framework!
Once your tests have run, view the Allure report in your browser:
- Automatic Link
Open this link directly: Allure Report