How to integrate Jira with Selenium

On This Page What is Jira?How to Create API Token in JiraJanuary 06, 2026 · 10 min read · Tool Comparison

How to incorporate Jira with Selenium

Jira integrating with Seleniumenables QA teams to automatically log defects into Jira whenever a test betray, removing manual effort and hasten up bug tracking. Jira, one of the most widely used issue-tracking and undertaking direction tool, unite with Selenium WebDriver ’ s automation power, gives testers an efficient way to connect tryout execution with real-time defect reporting.

Overview

Why Jira Integration with Selenium Matters

  • Jira: Leading tool for bug trailing, Agile project direction, and lifecycle workflows.
  • Selenium WebDriver: Widely used test automation framework with strong extensibility.
  • Integration Benefit: Automates defect reporting, improves traceability, and accelerates collaboration between QA and Dev teams.

Key Steps in Jira–Selenium Integration

  • Generate API Token in Jira: Authenticate REST API ring securely.
  • Add Jira Client Dependency: Use rcarz Jira-client to simplify API usage.
  • Set Up Selenium Tests: Flag test with annotations for defect logging.
  • Implement Utilities & amp; Listeners: Automate issue creation on examination failures, avoiding duplicates.
  • Configure TestNG: Register listeners to run incorporate test workflow.

Best Practices for Effective Jira Integration With Selenium

  • Use Jira project keys (little codes) for accurate issue mapping.
  • Securely manage API tokens to prevent exposure.
  • Prevent duplicate defects by checking existing issue.
  • Run Selenium tests onexistent devices and browsersvia cloud grids (e.g., BrowserStack) for authentic results.

This guide walks you through what Jira is, how to generate API tokens, and how to seamlessly mix it with Selenium to log issues directly from your automation retinue.

What is Jira?

Jira is a tool primarily used for. It also supports project management features for all kinds of use cases, from requirements and test case direction to Agile package growing.

Jira is free to use for up to 20 exploiter. However, if any arrangement requires additional features like support, storage, and a declamatory user limit they must go for the commercial-grade version. Since Jira is a bug/issue tag tool, it enables the assignment, resolution, and implementation of bug living cycle management.

Jira also provides Rest API endpoints with which testers can automate multiple actions such asCreate Issue, Assign Issue, Search the Issue,etc. So, if QAs are use they can direct log an issue in Jira using Jira API endpoints without the motive for manual interventions.

The undermentioned sections will describe how to create API Tokens, how to use Jira API, and how to create issues with Selenium.

How to Create API Token in Jira

Jira API tokens countenance a exploiter to authenticate with cloud apps and ringway two-step verification and SSO in order to find datum from the representative through REST APIs. Token hold allow admins to consider and revoke the use of API tokens by their managed accounts.

Basically, using the access token and user gens, testers can connect Selenium and Jira.

Steps to generate API token in Jira

  1. Navigate to your OrganizationJira website(ex: https: //example.atlassian.net/)
  2. Loginwith credentials
  3. Click on Profile and Settings
  4. Click on Account Settings
  5.  Click on Security. Then, click onCreate and deal API tokens
  6. In the API Tokens section Click onCreate API token
  7. Enter the Labeland click onCreate
  8. Once the token is created, copy and salve it in the desired location.

Note:After creating the API token don ’ t forget to replicate and save the item in the text editor. The token is not accessible once the pop-up disappears.

By following these step-by-step guidelines, users can create an API Token in Jira, which can be utilize to call Jira REST API termination inside someone ’ sSelenium Jiraintegration sections.

How to connect Selenium with Jira and log defects in Jira using Selenium

Let ’ s showtime with the prerequisites

  1. The Eclipse IDE, already install.
  2. The basic, already in place.

Note: This example uses, Selenium, the, and Java as programming language.

Now, let ’ s explore how to incorporate Jira with Selenium and then log defects in Jira.

  • Problem Statement:The user has their Selenium tests. When they execute the tests, and any of them fail, a Jira tag should be automatically make under the relevant Project.
  • Condition: If the same ticket has already be created in that particular project, ticket creation should be cut.

Note:Without this condition, task end up with a lot of duplicate issues each time they re-run multiple examination.

Step 1: Add required dependencies in pom.xml

In order to Integrate Jira with Selenium, usercarz Jira-clientfor simplicity. This is the wrapper built on top of the Jira Rest API Client.

SUSA automates exploratory testing with persona-driven behavior, catching bugs that scripted automation misses.

Navigate topom.xmlin the project, and add the following dependency:

& lt; dependency & gt; & lt; groupId & gt; net.rcarz & lt; /groupId & gt; & lt; artifactId & gt; Jira-client & lt; /artifactId & gt; & lt; version & gt; 0.5 & lt; /version & gt; & lt; scope & gt; compile & lt; /scope & gt; & lt; /dependency & gt;

Step 2: Create canonical tests expend Selenium and Java

Let ’ s make some introductory tests. This instance make two basic tests: one should pass and one should fail.

These tests are created under the packagecom.demo.project(placed in a suitable localisation)

Source Code: HomePageTest.java

 

// HomePageTest.java package com.demo.project; import motionless org.testng.Assert.assertEquals; significance static org.testng.Assert.assertTrue; import java.io.File; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; significance org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; meaning org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; meaning com.demo.utility.JiraCreateIssue; public form HomePageTest {private WebDriver driver; private String baseUrl; @ BeforeClass (alwaysRun = true) public void frame-up () throw Exception {File chromedriverExecutable = new File (`` driver/chromedriver.exe ''); System.setProperty (`` webdriver.chrome.driver '', chromedriverExecutable.getAbsolutePath ()); driver = new ChromeDriver (); baseUrl = '' https: //www.browserstack.com/ ''; driver.manage () .timeouts () .implicitlyWait (30, TimeUnit.SECONDS);} //Custom annotation explained in following sections @ JiraCreateIssue (isCreateIssue=true) @ Test public nullity verifyHomepageHeaderText () shed Exception {driver.get (baseUrl); WebElement el = driver.findElement (By.xpath (`` //h1 [1] '')); assertEquals (el.getText (), '' Browser Testing Made Easy '', '' Wrong header text displayed in Home page '');} @ JiraCreateIssue (isCreateIssue=true) @ Test public void verifyHomePageLogo () throw Exception {driver.get (baseUrl); WebElement el = driver.findElement (By.id (`` logotype '')); assertTrue (el.isDisplayed (), '' The browserstack logo not displaying in home page '');} @ AfterClass (alwaysRun = true) public vacuum tearDown () throws Exception {driver.quit ();}}

Sample Screenshot

Step 3: Create a utility to plow Jira issue

Let ’ s create a software inside the master foldercom.demo.utility, which will contain two classes

  1. JiraServiceProvider: This class will feature a method to create a Jira issue.
  2. JiraCreateIssue: This contains custom-made note code.

Below is the folder construction

Note:Custom annotation is optional but this provides flexibility to pluck and choose tests to be create eligible for ticket creation. For example, if some exam are not production-ready there ’ s no need to make tickets for them.

Source Code: JiraServiceProvider.java

// JiraServiceProvider.java package com.demo.utility; import net.rcarz.Jiraclient.BasicCredentials; import net.rcarz.Jiraclient.Field; importation net.rcarz.Jiraclient.Issue; import net.rcarz.Jiraclient.Issue.FluentCreate; importation net.rcarz.Jiraclient.JiraClient; import net.rcarz.Jiraclient.JiraException; public class JiraServiceProvider {private JiraClient Jira; individual String project; private String JiraUrl; public JiraServiceProvider (String JiraUrl, String username, String password, String labor) {this.JiraUrl=JiraUrl; // create canonical authentication object BasicCredentials creds = new BasicCredentials (username, word); // initialize the Jira customer with the url and the credentials Jira = new JiraClient (JiraUrl, cred); this.project = labor;} public void createJiraIssue (String issueType, String summary, String description, String reporterName) {try {//Avoid Creating Duplicate Issue Issue.SearchResult sr = Jira.searchIssues (`` compact ~ \ '' '' +summary+ '' \ '' ''); if (sr.total! =0) {System.out.println (`` Same Issue Already Exists on Jira ''); return;} //Create issue if not exists FluentCreate fleuntCreate = Jira.createIssue (project, issueType); fleuntCreate.field (Field.SUMMARY, sum-up); fleuntCreate.field (Field.DESCRIPTION, description); Issue newIssue = fleuntCreate.execute (); System.out.println (`` * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ''); System.out.println (`` New subject created in Jira with ID: '' + newIssue); System.out.println (`` New topic URL is: '' +JiraUrl+ '' /browse/ '' +newIssue); System.out.println (`` * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * '');} catch (JiraException e) {e.printStackTrace ();}}}

JiraCreateIssue.java:This is for Custom Annotation to be used insideSelenium tests.

Source Code: JiraCreateIssue.java

// JiraCreateIssue.java packet com.demo.utility; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Retention; @ Retention (RetentionPolicy.RUNTIME) public @ interface JiraCreateIssue {boolean isCreateIssue ();}

Step 4: Create Listener to notify test failures

Create a auditor so that each time a test fails, it should automatically create the Jira number method. This attender keeps track of test failures and executes specify code.

This example nominate the auditor asTestListener.java, created inside packagecom.demo.listener.

Source Code: TestListener.java

//TestListener.java package com.demo.listener; meaning org.apache.commons.lang.exception.ExceptionUtils; signification org.testng.ITestContext; import org.testng.ITestListener; import org.testng.ITestResult; import com.demo.utility.JiraCreateIssue; importee com.demo.utility.JiraServiceProvider; public class TestListener implement ITestListener {@ Override world void onTestFailure (ITestResult event) {boolean islogIssue = result.getMethod () .getConstructorOrMethod () .getMethod () .getAnnotation (JiraCreateIssue.class) .isCreateIssue (); if (islogIssue) {//Provide proper Jira project URL ex: https: //browsertack.atlassian.net //Jira User name ex: browserstack @ gmail.com //API token copy from Jira dashboard ex: lorelimpusm12uijk //Project key should be, Short name ex: BS JiraServiceProvider JiraServiceProvider = new JiraServiceProvider (`` https: //example.atlassian.net '', '' exemplar @ gmail.com '', '' lorelimpusm12uijk '', '' BS ''); String issueDescription = '' Failure Reason from Automation Testing\n\n '' + result.getThrowable () .getMessage () + '' \n ''; issueDescription.concat (ExceptionUtils.getFullStackTrace (result.getThrowable ())); String issueSummary = result.getMethod () .getConstructorOrMethod () .getMethod () .getName () + '' Failed in Automation Testing ''; JiraServiceProvider.createJiraIssue (`` Bug '', issueSummary, issueDescription, '' Automated Testing '');}} @ Override populace void onTestSkipped (ITestResult termination) {// TODO Auto-generated method nub} @ Override public void onTestFailedButWithinSuccessPercentage (ITestResult result) {// TODO Auto-generated method nub} @ Override public quash onStart (ITestContext context) {// TODO Auto-generated method nub} @ Override public void onFinish (ITestContext context) {// TODO Auto-generated method nub} @ Override public void onTestStart (ITestResult result) {// TODO Auto-generated method stub} @ Override public void onTestSuccess (ITestResult event) {// TODO Auto-generated method nub}}

Crucial Points to remember when creating a JiraServiceProvider object:

  • JiraUrl: This should be a company Jira URL. If someone is utilize the Jira cloud it will be something like:https: //xyz.atlassian.net
  • username: This argument is the login gens (typically email) but calculate on the configuration (ex:)
  • password: If using the Jira cloud, one must pass theAPI Tokenas a countersign. Using one ’ s login watchword might not work (example API item: lorelimpusm12uijk)
  • project: This is theprojection Key, often named with two letter (ex: BS). Using the full project name like BrowserStack Project might not act, so always use the short version.

How to get project key In Jira

  1. Navigate to Jira URL (https: //example.atlassian.net)
  2. Click on Projects Menu
  3. Click onView All Projects
  4. Choose theDesired Project
  5. On Project Page, Click onProject Settings
  6. Look for the battlegroundKey. This is the short project Key
  7. Just copy and use it as a task key

After completion of Step 4 the project looks as below:

Step 5: Configure the testng.xml file

Once we have all the required set up, we need to have a testng.xml file configured to run our tests. Our sample xml file looks like below. (You can use your subsist testng.xml file to run your exam).

Source Code: Sample testng.xml file

& lt;? xml version= '' 1.0 '' encoding= '' UTF-8 ''? & gt; & lt; suite name= '' Default suite '' parallel= '' methods '' verbose= '' 3 '' & gt; & lt; listeners & gt; & lt; listener class-name= '' com.demo.listener.TestListener '' / & gt; & lt; /listeners & gt; & lt; test name= '' First test '' skipfailedinvocationcounts= '' mistaken '' & gt; & lt; grade & gt; & lt; class name= '' com.demo.project.HomePageTest '' & gt; & lt; /class & gt; & lt; /classes & gt; & lt; /test & gt; & lt; /suite & gt;

Step 6: Execute your tests

Once setup is complete, execute the tests. Once tests are fulfill, any failures should automatically create a Jira ticket. After execution, view the result in the console.

Sample Console Output

If everything is correct then after all Selenium tests run, it will create a Jira Issue, and the console will return as output & # 8211;Ticket ID/Issue ID(ex: 32 in above image). It will likewise volunteer theURLto pilot to that particular subject.

Step 7: Ensure ticket created in Jira

Let ’ s navigate to the Jira splashboard to check whether an issue has been created or not. In the Jira splasher, click on the project dashboard to see if a new issue has be make, as testify below:

Most of the operations execute through the Jira user interface can be run using the REST API client. The Jira REST API client allows testers to automate the matter tracking and logging process, reducing the need for manual effort and attention.

Bear in mind exam must be fulfill on existent devices and browsers. Remember that is a major care for every developer and examiner. Every site has to work seamlessly on multiple device-browser-OS combination. With be apply to access the net globally, all software has to be optimized for different configurations, viewports, and screen resolve.

In this state, no emulator or simulator can retroflex. Software needs to be tested on real device so that they can work in real-world circumstances such as a low battery, incoming call,, and so on. If an in-house is not approachable, opt for a that offers real device.

BrowserStack ’ s offers 3500+ real devices and browsers for automated testing. That means users can run tests on multiple real devices and browser by simply signing up, logging in, and select the required combinations. Testers can also conduct on 30+ real browser variation across Windows and macOS. Detects bugs before users do by testing package in real user conditions with BrowserStack.

Tags
36,000+ Views

# Ask-and-Contributeabout this topic with our Discord community.

Related Guides

Automate This With SUSA

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.

Try SUSA Free

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free