Automated Defect Creation in JIRA
Prerequisite: Jenkins basic knowledge.
Jenkins is an orchestration engine facilitating automated builds, packaging, deployments & execution of sanity/regression test suites. These tests can be executed after every deployment or can be scheduled to run at a fixed interval using the in-built scheduler. An execution report is then prepared & circulated to appropriate audience once these tests are executed. In the majority of cases, the QA team needs to raise defects manually pertaining to issues reported in this report, which is a time consuming activity & does not add any value to the project delivery. This can now be done in an automated manner with the issue tracking tool plug-ins (JIRA, in our case) following below steps :
Open Jenkins and install following plugins:-
a) JIRA plugin
b) JiraTestResultReporter plugin
Restart Jenkins and, open Manage jenkins > Configure System
Scroll down to “JiraTestResultReporter” and “JIRA” section , enter jira URL , Username and Password.
Now move to your jenkins job and open section “Post-build Actions”.
Select , option JIRA: Create issue.
Enter respective details like “Jira Project Key” , “Assignee”, “Description of Test” , “Issue Priority” and “Issue Type” like in below image:
Note: In the “Issue type” field in above screenshot, you can select other values like “Defect” depending upon your project configuration in JIRA.
Now again from “Post-build Actions” in your, job select “Additional test report features” and then “JiraTestResultReporter”.
Enter respective details like “Project key”, “Issue Type” , “Assignee” , “Summary” , “Description” and “labels” and check “Auto raise issues” like in below image:
After completing all the above configuration steps, run the Jenkins job. Once the test scripts execution via Jenkins job is performed, log in to JIRA and search for defects under the Label value (Refer to step 8 ) specified in configuration settings. You will find all the defects created corresponding to the test cases failed during execution.
If you check “Auto raise issue” , the defects are created the very moment build execution completes. But if you don’t check “Auto raise issue” and want to take a look at list of failed tests before creating defects. You need to follow one more steps:
- Click on the Latest build > Test Result.
- There will be list of failed tests and corresponding “No issue” text with plus link. Click on plus link and then “Create new issue”, the issue will be created in JIRA. please refer below image.
Before running next build:
- All the defects raised should be fixed and marked done manually in JIRA.
- After that in Jenkins job move to latest build > Test Results and click on cross icon of the bugs which are fixed. Please refer to below screenshot:
Note: You should provide step wise description in assert functions this will help the developer in understanding defect steps.
Hope this blog will help my fellow Automation Test Engineers in saving some time 🙂 , Please do provide your valuable feedback.