How To Integrate Jenkins & Maven With Selenium?

How To Integrate Jenkins & Maven With Selenium?

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.

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.

A quick summary of the blog post is below:

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 pom.xml 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 pom.xml, 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 [Link]
  • *TestNG *– Popular test automation framework [Link]
  • Selenium WebDriver – Library primarily used for automation of browser interactions [Link]
  • Jenkins – Tool for Continuous Integration (CI) and Continuous Deployment (CD) [Link]

Here is the overall flow of information when Selenium, Maven, and Jenkins are integrated:

  • 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 testing.xml, and the same is also used in pom.xml.
  • 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.’

automation ci/cd devops jenkins

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Travis CI vs Jenkins: Which CI/CD Tool Is Right For You?

The ultimate showdown between Travis CI vs Jenkins. Check out this guide to know who wins the race! Travis CI and Jenkins are both popular CI/CD tools and were launched in the same year i.e. 2011. As of July 2020, Jenkins has been the more obvious choice as CI/CD tool with 15.9k stars & 6.3k forks, in comparison to TravisCI which has 8k stars & 756 forks. However, these numbers alone don’t imply which CI/CD tool is more suitable for your upcoming or existing project. Jenkins is an open-source & Travis CI is free for open-source projects.

DevOps Automation: How to Apply Automation Into Your Software Delivery Process

DevOps automation tools help increase your application development agility and speed up delivery for software changes.

Jenkins Is Getting Old — It’s Time to Move On

After using Jenkins on several projects, we say it's time to move on. Jenkins is left behind with his old approach — found out more!

Jenkins Is Getting Old—and We Need an Alternative

By far, Jenkins is the most adopted tool for continuous integration, owning nearly 50% of the market share. As so many developers are using it, it has excellent community support, like no other Jenkins alternative. With that, it has more than 1,500 plugins available for continuous integration and delivery purposes.

Travis CI vs Jenkins: Which CI/CD Tool Is Right For You?

Travis CI and Jenkins are both popular CI/CD tools and were launched in the same year i.e. 2011. As of July 2020, Jenkins has been the more obvious choice as CI/CD tool with 15.9k stars & 6.3k forks.