100% found this document useful (1 vote)
18 views5 pages

Selenium Tests in Jenkins with Maven

The document outlines an experiment aimed at setting up and running Selenium tests in Jenkins using Maven. It explains the roles of Jenkins, Maven, and Selenium in continuous integration and automation testing, detailing the process of triggering builds and executing tests. The conclusion emphasizes the learning outcome of the experiment regarding the integration of these tools.

Uploaded by

Sonam Gupta
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
18 views5 pages

Selenium Tests in Jenkins with Maven

The document outlines an experiment aimed at setting up and running Selenium tests in Jenkins using Maven. It explains the roles of Jenkins, Maven, and Selenium in continuous integration and automation testing, detailing the process of triggering builds and executing tests. The conclusion emphasizes the learning outcome of the experiment regarding the integration of these tools.

Uploaded by

Sonam Gupta
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Name: Sonam Gupta

Roll No. : 201903015 (14)


Subject: DevOps Lab
Experiment No. 7

Aim: To Setup and Run Selenium Tests in Jenkins Using Maven.


Theory: Jenkins is one of the popular tools for continuous integration, build
management, and automation testing. Maven is a popular build automation tool
that is widely used for Java projects. The combination of Selenium, Maven,
Jenkins integration is the pinnacle of continuous integration and deployment.
As a part of automation testing, we’re sure your team comes up with
numerous Selenium test automation scripts every other day. As Selenium itself
is not used for Continuous integration, Selenium, Maven, and Jenkins
integration are leveraged for build management and continuous integration. In
this article, we look at the usage of Maven and Jenkins with Selenium.
Overview Of Selenium, Maven, & Jenkins:
Maven is a popular build automation tool that is primarily used for Java
projects. The advantage of using Maven is that Java libraries and plugins are
downloaded on a dynamic basis from the Maven 2 Central Repository.
The dependencies and other essential build-related information are stored in a
[Link] file of the project. Once downloaded, the dependencies are stored in a
local cache (.M2 repository), and the same is used for build generation. This
simplifies the build process, as any new project dependency has to be added
only in [Link], i.e., no manual downloading and installation packages are
required.
Selenium is a widely used test automation framework for validating web
applications across different combinations of browsers, platforms, and devices
(or emulators). You can refer to our blogs on how Selenium Grid can be used
for automated browser testing.
Jenkins is an open-source CI/CD tool that helps in the automation of activities
related to build, test, and deployment. Jenkins has an extensive plugin
ecosystem, is open-source, and a passionate community – factors that can be
attributed to Jenkins’ features.
In this Maven and Jenkins with Selenium blog, we would be using TestNG,
which is a popular test framework that is inspired by JUnit. It is widely used for
testing areas such as functional testing, end-to-end testing, and more.
These are the set of tools that we would be using in the demonstration:
 Maven – Project management tool in Java
 TestNG – Popular test automation framework
 Selenium WebDriver – Library primarily used for automation of
browser interactions
 Jenkins – Tool for Continuous Integration (CI) and Continuous
Deployment (CD)

Figure 1

 Once the developer pushes code into the repository (e.g., GitHub), a
Jenkins build is triggered.
 Maven downloads the dependent libraries & packages and starts
performing the build. The information related to the test suite is available
in [Link], and the same is also used in [Link].
 A build goal (e.g., install) for running the automated tests is set. The same
is achieved through the maven-surefire-plugin.
 The maven-surefire-plugin tells TestNG to run the tests that are under the
annotation @Test.
 Depending on the AUT (application under test) and the browser (& OS
combination) on which cross browser tests are performed, the Selenium
WebDriver invokes the corresponding browser instance and executes the
same automation tests.
 Test results are published in HTML Reports, as the HTML Publisher
plugin is used for report generation.
 Even if a single test case has failed, the complete test is marked with
status ‘Failed.’

Create a new maven project and name it as “exp7” and click on “OK”:

Figure 2

Paste git repository link as give n below:

Figure 3
Write goal in it as “test” and save it:

Figure 4

Build the project “exp7” by clicking on “build now” button:

Figure 5
Figure 6

It will show finished with success message after building project:

Figure 7

Conclusion: By doing this experiment I get to know about how to Setup and
Run Selenium Tests in Jenkins Using Maven.

You might also like