Will Selenium Jira Integration Ever Rule the World?
Will Selenium Jira Integration Ever Rule the World?
Selenium is the most preferred web automation tool by testers. Selenium Web driver is used for automation testing by testers across teams and organizations.
The important feature of selenium is its flexibility. That means testers can create their frameworks as required, extend them and hook them up with multiple services. Because of selenium’s different feature it stands up in all modern frameworks which are available in market.
For more accurate results and better efficiency testers can integrate Selenium with Jira.
This blog talk about how to integrate Selenium with Jira in a minimum-hassle way.
What is Selenium Web driver?
Selenium Web driver is web based functional automation tool. We can automate web-based applications using selenium Web driver. It supports various browsers like Google chrome, Mozilla Firefox and operating systems.
Earlier Jira was a tool which is used for bug and issue tracking. Now it also supports project management features for all use cases, from requirements and test case management to Agile software development.
By using Jira, we can plan teams, can generate reports, can assign tasks and can bring team together from agile software development.
Below are the steps for how to create API Tokens, how to use Jira API, and how to create issues with Selenium.
What is an API?
API – Application programming interface. It serves as a data transmitter between two various pieces of software.
How to Create API Token in Jira
Jira API tokens allow a user to authenticate with cloud apps and bypass two-step verification and SSO to retrieve data from the instance through REST APIs.
By using access token & user name, testers can connect Selenium and Jira.
Follow below steps to generate API token in Jira
- Navigate to your Organization Jira website (ex: https://example.atlassian.net/)
- Login with credentials
- Click on Profile and Settings
- Click on Account Settings
- i) Click on Security. After, click on Create and manage API tokens
- In the API Tokens section, click on Create API token
- Enter the Label & click on Create
- a) Once the token is created, copy and save it in the desired location.
Below mentioned steps are for help – users can create an API Token in Jira, which can be used to call Jira REST API endpoints inside Selenium Jira integration sections.
What is Maven?
Maven can build any number of projects into desired output such as .jar, .war and metadata. It is used to create projects, dependency, and documentation using plugins & Project Object Model.
It creates POM. xml file where we can add our dependencies (it’s just like jar file we add).
Also, it creates 4 different folders
- 1. Src/main/java – developer write actual code
- 2. src/main/resources – project development external files, like xml, txt. Used by developer
- 3. src/test/java – tester writes test case over here.
- 4. src/test/resources – for testing purposes external file required, the tester will store in it.
How to create a maven project?
- 1. On eclipse go to->File -> New Project.
- 2. Select Maven Project.
How to Add dependencies in POM.xml?
Search for maven repository on google. Search for respected dependencies add it on. –
POM framework in Selenium?
Page Object Model is just a design. As the name says we will be working as pages (pages will be pure Java classes). Using POM, you can achieve features like Easy to maintain, readable format, reusable scripts.
How to connect Selenium with Jira and log defects in Jira using selenium
Let’s start with the prerequisites
- 1. The Eclipse IDE, already installed.
- 2. The basic Maven Project Set up, already in place.
Now, let’s explore how to integrate Jira with Selenium and log defects in Jira.
- Problem Statement: The user has their Selenium tests. When they execute the tests, and any of them fail, a Jira ticket should be automatically created under the relevant Project with the screenshot.
1) In the src/main/java package – create different packages for common actions, Web Elements and Actions, config data, test data, as shown in the following picture,
- In COM.CONFIGURATION package created class Config which has methods required for all the classes related to URL, browser Name, test data file, csv file path, jiraSecretKey, Jira URL, Jira Username etc.
- In COM.CONFIGURATION package created class Driver where delcared object driver publicly so that we can access it publicly.
- In COM.PAGES package Every java class contains web Elements and actions performed on that particular page.
- For e.g., LoginPage.java – created class LoginPage where using locators located web Elements like Username, password, button.
- In COM.COMMON package created class Common where source code available for Driver Launching, for reading the Login CSV file, Creating Jira issue bug, Converting HTTP Response to String, convert String to JSON, extract issue key from JSON
Source code for Initialization of driver and Reading Csv file –
Source code for Create Jira issue bug –
Source code for Adding attachment to Jira –
- COM.TESTDATA package contains test data in the form of excel, csv file, etc
- In COM.SPECS created class Login where code for adding screenshot of failed test & JIRA Defect Creation part –