This project is a Selenium-based test framework for automating web application testing using Java and JUnit. It includes example tests for login validation, purchase flow on SauceDemo, and dynamic controls testing on Herokuapp.
- Java Development Kit (JDK) 17 or higher
- Chrome browser (version 114.0.5735.90 or compatible)
- ChromeDriver (matching your Chrome browser version)
- Selenium and JUnit libraries (included in the
lib/folder)
-
Clone the repository:
git clone https://github.com/Nyaxize/web_testing_project2.git cd web_testing_project2 -
Add ChromeDriver:
- Download the version of ChromeDriver matching your Chrome browser from ChromeDriver Downloads.
- Place the
chromedriver.exefile in the root folder of your project (or set its path in the code).
-
Set up your development environment:
- Use Visual Studio Code or any other Java IDE.
- Ensure
src/andlib/are added to your project's classpath.
java_web_testing_project/
β
βββ lib/ # Selenium and JUnit library dependencies
βββ src/ # Source code for tests
β βββ HerokuappLoginTest.java # Test for Herokuapp login page
β βββ HerokuappDynamicControlsTest.java # Test for dynamic controls
β βββ HerokuappDropdownTest.java # Test for dropdown selection
β βββ SauceDemoCheckoutTest.java # Test for SauceDemo purchase flow
βββ .gitignore # Files to be ignored by Git
-
Compile the tests:
javac -cp "lib/*;src" -d bin src/*.java
-
Run a specific test:
java -cp "lib/*;bin" org.junit.runner.JUnitCore SauceDemoCheckoutTest
- Ensure that your ChromeDriver version matches the installed version of Chrome.
- The
lib/folder already contains the required.jarfiles for Selenium and JUnit. - If you encounter issues, check the browser and WebDriver compatibility or update paths in the code.