/the-internet-automation-java-selenium

Automation tests for the-internet.herokuapp.com with Java Selenium WebDriver and TestNG

Primary LanguageJava

Test Automation for the-internet.herokuapp.com

This project contains automation tests written in Java using Selenium WebDriver and TestNG for the website the-internet.herokuapp.com. The purpose of these tests is to improve your test automation skills and demonstrate how to automate different scenarios on the website.

Project Structure The project is structured as follows:

|-- src
|   |-- main
|   |   |-- java
|   |   |   |-- pages
|               |-- HomePage.java
|               |-- LoginPage.java
|               |-- ...
|   |   |-- resources
|   |
|   |-- test
|       |-- java
|           |-- base
|               |-- BaseTests.java
|           |-- login
|               |-- LoginTests.java
|           |-- ...
|       |-- resources
|
|-- .gitignore
|-- pom.xml
|-- README.md
  • The src directory contains the main source code and test code.
  • The src/main/java directory is where you can place any utility classes framework or page object model classes.
  • The src/test/java directory contains the test classes where you'll write your test cases.
  • The src/test/resources directory is where you can store any test-specific resources, such as test data files or configuration files.
  • The src/test/resources/testng.xml file is the TestNG configuration file where you can configure your test suites, test groups, and other settings.
  • The .gitignore file specifies which files and directories should be ignored by Git version control.

Prerequisites

To run the automation tests in this project, you'll need to have the following software installed on your machine:

  • Java Development Kit (JDK) 10 or higher
  • Apache Maven
  • Selenium WebDriver
  • TestNG

Running the Tests

Follow these steps to run the automation tests:

  • Clone the repository to your local machine: $ git clone

  • Navigate to the project directory: $ cd project-directory

  • Build the project using Maven: $ mvn clean install

  • Execute the tests using the TestNG runner: $ mvn test ##Writing Test Cases To create new test cases or modify existing ones, follow these guidelines:

  • Create a new Java class under src/test/java/ or add your test cases to an existing class.

  • Use the TestNG annotations (@Test, @BeforeMethod, @AfterMethod, etc.) to define your test methods and set up/tear down steps.

  • Leverage Selenium WebDriver API to interact with the web elements on the website under test.

  • Implement assertions to verify the expected outcomes of your test cases.

Continuous Integration

You can integrate this project with any Continuous Integration (CI) tool of your choice, such as Jenkins or Travis CI. Set up a CI pipeline to automatically build and execute the tests on each commit or at specific intervals.

Contributing

Contributions to this test automation project are welcome. If you find any bugs, issues, or have suggestions for improvements, please open an issue or submit a pull request.