This repository is a web automation project that applies Object-Oriented Programming (OOP) principles and utilizes the TestNG framework, Maven for dependency management, and the Selenium automation tool. The project aims to conduct automated tests on the MakeMyTrip website to extract the top price information.
The primary aim of this project is to showcase automated testing capabilities utilizing Selenium, TestNG, and Maven. Specifically, it targets the extraction of the top price from the MakeMyTrip website.
- TestNG: Testing framework providing functionalities for various test types.
- Maven: Build automation tool managing dependencies and project configuration.
- Selenium: Powerful web browser automation tool.
Ensure the following are installed:
- JDK
- Maven
- TestNG framework
- Chrome or Firefox browser
Add the following to your pom.xml
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.11.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-chrome-driver -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>4.11.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager -->
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.4.1</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>selenium</id> <!--Feel free to name it what you want, the following id to run later in the console-->
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testNG.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>
page
: Directory for classes representing different functionFlightPageTest.java
: Contains actual test cases related to the functionalities, also executing tests.
java
├── page
│ ├── BasePage.java
│ ├── FlightPage.java
│ └── HomePage.java
└── test
├── BaseWebTest.java
└── FlightPageTest.java
Run the FlightPageTest.java
file directly from the IDE, I'm using IntelliJ IDEA or run using the terminal using this command
mvn test -Pselenium
Navigate to the surefire-report
directory, and you will see emailable-report.html
and index.html
that have been created, for example:
target
└── surefire-reports
├── emailable-report.html
├── index.html