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
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. Why Jira Integration with Selenium Matters Key Steps in Jira–Selenium Integration Best Practices for Effective Jira Integration With Selenium 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. 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. 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. 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. Let ’ s showtime with the prerequisites 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. 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: 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 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 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 JiraCreateIssue.java:This is for Custom Annotation to be used insideSelenium tests. Source Code: JiraCreateIssue.java 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 Crucial Points to remember when creating a JiraServiceProvider object: How to get project key In Jira 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 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. # Ask-and-Contributeabout this topic with our Discord community. Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed. Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.How to incorporate Jira with Selenium
Overview
What is Jira?
How to Create API Token in Jira
Steps to generate API token in Jira
How to connect Selenium with Jira and log defects in Jira using Selenium
& 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;
// 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 ();}}// 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 packet com.demo.utility; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Retention; @ Retention (RetentionPolicy.RUNTIME) public @ interface JiraCreateIssue {boolean isCreateIssue ();}//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}}& 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;
Related Guides
Automate This With SUSA
Test Your App Autonomously