Project Information

Learn why the TestNg, Maven, and Page Object Model tools are used in the automation project.

We'll cover the following

The project uses the following technologies:

  • Programming language: Java
  • Dependency management and test execution: Maven
  • Unit-testing framework: Test NG
  • Automation library: Selenium WebDriver
  • Automation pattern: Page Object Model
Technologies used

A few details on each technology

The project is created using Maven for multiple reasons. Maven maintains the project dependencies (Selenium WebDriver and Test NG) through the pom.xml file. With Maven, the project has a standard structure with src and target folders.

Maven commands can be used for compiling the code (mvn compile), cleaning previous project artifacts (mvn clean), and executing automated tests (mvn test).

This is what the Maven pom.xml file looks like:

Press + to interact
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>selenium</groupId>
<artifactId>selenium</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>selenium</name>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.10</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>

Test NG is chosen as the unit-testing framework instead of jUnit because of its test listeners, which will be used for taking screenshots and logging exceptions/stack traces to a log file.

The automated tests are implemented as TestNG unit tests. They are short, independent, easy to understand, and split into groups. Each automated test implements a test case.

The automation code uses a few layers, each layer using the next one:

  • Test classes
  • Page object classes
  • Automation framework
  • Selenium WebDriver

The automation framework has components for creating the driver object, taking screenshots, and creating trace and exception logs.

The project’s code is introduced in the following order:

  • The test class
  • The base test class
  • The page object classes
  • The automation framework
Project structure