A comprehensive test automation suite for the DemoQA website using Selenium WebDriver, Java, and TestNG framework.
This project implements automated test scenarios for various UI components on the DemoQA website including:
- Form Testing: Text box submissions and checkbox selections
- UI Interactions: Alert handling and iFrame operations
- Data-Driven Testing: Practice form submission with multiple data sets
- Java 11+
- Selenium WebDriver 4.15.0
- TestNG 7.8.0
- WebDriverManager 5.6.2
- Maven (Build tool)
testnow/
├── src/
│ ├── main/java/
│ └── test/
│ ├── java/com/demoqa/
│ │ ├── base/
│ │ │ └── BaseTest.java
│ │ └── tests/
│ │ ├── FormTests.java
│ │ ├── InteractionTests.java
│ │ └── DataDrivenStudentFormTests.java
│ └── resources/
│ └── testng.xml
├── pom.xml
└── README.md
- testTextBoxSubmission: Tests text box form submission with name and email validation
- testCheckBoxSelection: Tests checkbox selection and result verification
- testHandleAlerts: Tests confirm alert handling and verification
- testHandleIFrames: Tests iFrame switching and content reading
- testStudentFormSubmission: Data-driven test with @DataProvider for practice form submission
- Java 11 or higher installed
- Maven 3.6+ installed
- Chrome browser installed (tests run on Chrome by default)
- Git for version control
- Clone the repository:
git clone <repository-url>
cd testnow- Install dependencies:
mvn clean installmvn test# Run Smoke tests only
mvn test -Dgroups=Smoke
# Run Regression tests only
mvn test -Dgroups=Regression# Run FormTests only
mvn test -Dtest=FormTests
# Run InteractionTests only
mvn test -Dtest=InteractionTests
# Run DataDrivenStudentFormTests only
mvn test -Dtest=DataDrivenStudentFormTestsmvn test -DsuiteXmlFile=src/test/resources/testng.xmlThe tests are configured to run on Chrome browser with the following options:
- Window size: 1920x1080
- Disabled sandbox and dev-shm-usage for CI environments
- Implicit wait: 10 seconds
To run in headless mode, uncomment the headless option in BaseTest.java:
options.addArguments("--headless");All tests are organized into two groups:
- Smoke: Critical functionality tests
- Regression: Comprehensive test coverage
- URL: https://demoqa.com/
- Test Pages:
- Text Box:
/text-box - Check Box:
/checkbox - Alerts:
/alerts - Frames:
/frames - Practice Form:
/automation-practice-form
- Text Box:
TestNG generates test reports in the target/surefire-reports directory after test execution.
The project follows a systematic commit approach:
- Initial setup commits
- Individual feature commits for each test class
- Clear commit messages tracking progress
- WebDriver not found: WebDriverManager automatically handles driver downloads
- Element not clickable: Tests use explicit waits and JavaScript executors as fallback
- Timeouts: Adjust implicit/explicit wait times in BaseTest.java if needed
- Follow the existing code structure and naming conventions
- Add appropriate TestNG annotations and groups
- Include proper assertions and error messages
- Update documentation for new test scenarios