Open In App

Working with Jenkins Plugins

Last Updated : 28 Mar, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Jenkins plugins are essential for enhancing the functionality of the Jenkins CI/CD tool, allowing seamless integration with various tools, frameworks, and systems. This guide delves into the significance of plugins in Jenkins, their role in automation testing, and how to use popular plugins to streamline processes.

What are Jenkins Plugins?

Jenkins plugins extend the core capabilities of Jenkins, enabling integration with additional tools and technologies. They allow developers and testers to customize Jenkins based on specific project requirements.

  • Purpose: To simplify automation processes, enhance test reporting, and improve integration with tools like Maven, Cucumber, and TestNG.
  • Source: Plugins are either developed by the Jenkins community or the Jenkins team.

Why are Jenkins Plugins Important?

Plugins significantly improve the efficiency of Jenkins workflows:

Jenkins workflows of plugins
Jenkins workflows of plugins

1. Test Execution Integration

  • Integrates with tools like Selenium, Cucumber, TestNG, and JUnit.
  • Automatically generates and publishes test reports.

2. Reporting

  • Provides detailed insights into test results with plugins like Allure and HTML Publisher.
  • Visualizes build trends, pass/fail ratios, and test execution details.

3. CI/CD Integration

  • Accelerates feedback loops.
  • Identifies defects early by integrating tools like Git and Maven.

4. Notification and Collaboration

  • Sends automated alerts using email or communication tools like Slack and Microsoft Teams.
  • Accessing Plugins in Jenkins

How to Install and Manage Jenkins Plugins

To install or manage plugins in Jenkins, follow these steps:

1. Open Jenkins Dashboard
2. Go to Manage Jenkins → Plugin Manager
3. Click on Available Plugins to search and install new ones
4. Check Installed Plugins to see what’s already there
5. Go to Updates and update outdated plugins
6. Restart Jenkins to apply changes

Keeping your plugins updated ensures that you get better security, improved performance, and new features.

For complete installation refer - Jenkins Plugin

Key Plugins for Test Automation

The following are the key plugins used for Test Automation:

Key Plugins for Test Automation
Key Plugins for Test Automation

1. JUnit Plugin

  • Publishes test results from JUnit or other xUnit test frameworks.
  • Displays test reports in the Jenkins UI and tracks test pass/fail history across builds.

2. TestNG Results Plugin

  • Publishes and displays results for TestNG-based tests.
  • Includes detailed reports on passed, failed, and skipped tests.

3. Maven Integration Plugin

  • Automates building and testing for Maven projects.
  • Manages the build lifecycle, dependencies, and report generation.

4. HTML Publisher Plugin

  • Allows Jenkins to publish and display custom HTML reports, such as those generated by frameworks like Selenium or JUnit.
  • Useful for visualizing test automation results.

5. Allure Report Plugin

  • Integrates with Allure to generate detailed and visually appealing reports for various test frameworks, including JUnit, TestNG, and Selenium.
  • Provides insights into test execution, including duration, environment, and failure analysis.

Manage Jenkins Plugins

  • Navigate to Manage Jenkins > Plugins.
Manage Jenkins
Manage Jenkins > Plugins.

Installed Plugins

  • Lists pre-installed plugins (e.g., Git, JUnit).

Available Plugins

  • Search for and install additional plugins.

Updates

  • Check for updates to keep plugins up-to-date.
  • Popular Jenkins Plugins for Automation Testing

Plugin Purpose

  • JUnit Plugin Parses test results from JUnit and displays pass/fail statistics in Jenkins.
  • TestNG Plugin Integrates TestNG results with Jenkins, showing method-level execution statistics.
  • Maven Integration Simplifies the creation of Maven-based Jenkins jobs.
  • HTML Publisher Publishes HTML reports generated by automation frameworks.
  • Allure Reports Generates visually appealing and detailed test execution reports.
  • Cucumber Reports Publishes JSON-based Cucumber reports in an easy-to-read HTML format.
  • Git Plugin Integrates Jenkins with Git repositories.
  • Email Extension Sends email notifications based on test results or build statuses.

How to Use Jenkins Plugins (Step-by-Step Guides)

Publishing Cucumber Reports

Objective: Generate a readable report from Cucumber's JSON output.

Install the Cucumber Reports Plugin

  • Install Cucumber Reports Plugin:
  • Navigate to Available Plugins and search for "Cucumber Reports."
Available Plugins and search for "Cucumber Reports."
Available Plugins and search for "Cucumber Reports."
  • Install the plugin.

Configure Jenkins Job

  • Firstly check the cucumber project run locally as expected
Screenshot-2024-11-25-160828
cucumber project run locally
  • Add a build step to execute your Cucumber project.
build step to execute your Cucumber project.
build step to execute your Cucumber project.
  • Copy the project from existing project which you are already created:
Copy the project from existing project
Copy the project from existing project
  • Updates the goal as per our requirement:
Updates the goal as per our requiremen
Updates the goal as per our requiremen
  • Ensure the test runner generates a cucumber.json file.

Post-Build Actions

  • Select Cucumber Reports.
Select Cucumber Reports
Select Cucumber Reports
  • After that save the project and build the project.

Run the Job

  • View the generated report in the Jenkins dashboard.

Output

  • A detailed HTML report showing:
  • Passed, failed, and skipped steps.
generated report in the Jenkins dashboard
generated report in the Jenkins dashboard
  • Execution time for each step.
  • Overall test summary.

Integrating jenkins with TestNG

Objective: Visualize TestNG execution results in Jenkins.

Steps

  • Install TestNG Results Plugin:
  • Search for "TestNG Results" in Available Plugins and install it.
TestNG Results plugin
TestNG Results plugin

Configure Job

  • Execute TestNG tests and ensure the results are saved in XML format in locally first
Configure Job
Configure Job
  • Create a new project in jenkins.
create a new testng job in jenkins
create a new testng job in jenkins
  • Use the same as last we used copy the project using the last project configuration which we used.
copy the project using the last project
copy the project using the last project

Use this Repository URL for the Project: Repository

  • Update the Repository URL in the Jenkins project configuration
Update the Repository URL
Update the Repository URL
  • The goals and options of the project is like these:
The goals
The goals

Post-Build Action

  • Select Publish TestNG Results.
Select Publish TestNG Results
Select Publish TestNG Results
  • Provide the path to the TestNG results file.

Run Job

  • View method-level statistics and overall execution details.

Output:

Run Job
Run Job
  • Execution trends and test statuses displayed in Jenkins.
  • Here are the testNG results :
 testNG results
testNG results

3. Publishing HTML Reports

Objective: Display custom HTML reports generated by automation frameworks.

Steps

  • Install HTML Publisher Plugin:
  • Search for "HTML Publisher" and install the plugin.

Configure Job

  • Create a new job
Create a new job
Create a new job
  • Copy the same project which we last used:
Copy the same project
Copy the same project

We used all configuration of the last project only we change the report template with the HTML publisher:

  • Select Publish HTML Reports.
  • Provide the directory and file path.
report template with the HTML publisher
report template with the HTML publisher
  • Ensure your automation framework generates an HTML report.
  • Specify the report directory and file name (e.g., target/surefire-reports/index.html).
Specify the report directory and file name
Specify the report directory and file name

Run Job

  • Access the HTML report from the Jenkins dashboard.

Output

Access the HTML report
Access the HTML report
  • Fully formatted HTML reports, accessible via Jenkins.

Conclusion

Plugins are the backbone of Jenkins, enabling it to adapt to diverse project needs. By leveraging plugins for reporting, automation, and integration, teams can streamline their CI/CD workflows and enhance efficiency. Whether it’s generating detailed test reports or automating notifications, plugins make Jenkins a powerful tool for developers and testers.


Next Article

Similar Reads