Create an issue using Jira API with JMeter

Raghwendra Sonu
3 min readOct 23, 2019

--

In this article we are going to use Jira API with JMeter to perform set of tasks like creating a bug, adding a user as watchers, deleting a comment etc.

I have setup Jira for my project.

As you see in the above snapshot, 
Jira Base URL: https://qatechtesting.atlassian.net/
Project Key: QA

Here is Rest API example on how to create an Issue in Jira:
https://developer.atlassian.com/server/jira/platform/jira-rest-api-example-create-issue-7897248/

Here is the documentation of Jira Rest API’s: https://docs.atlassian.com/DAC/rest/jira/6.1.html

As mentioned on this page, the API to create an issue is : /rest/api/2/issue. We will use this shortly.

Launch JMeter, and create a new test plan. Add an HTTP Request Sampler in the Test Plan and configure that as below:

POST request body data:

{
"fields": {
"project":
{
"key": "QA"
},
"summary": "My First Bug using Jira- RestAPI",
"description": "Creating an issue using Jira- RestAPI. Please have a look.",
"issuetype": {
"name": "Bug"
}
}
}

Before executing this, we need to add HTTP Header Manager to instruct that this request is going to be of application/json type.

Also, add a HTTP Authentication Manager, as we have to login to Jira before creating an issue.

Base URL:https://qatechtesting.atlassian.net
Username:sonucts@gmail.com
Password:<<Note that the password is NOT your password to login, but an API token. To generate an API token, go to https://id.atlassian.com/manage/api-tokens# and create a new one. >>

In the end, add a listener to see the execution results and logs.

This is how overall Test Plan will look like now.

Finally, execute the test and analyze the results.

Verify that in Jira this issue has been created successfully.

In the same way we can use PUT and Delete requests to update or Delete the created bug.

There are many actions which can be done using Jira Rest API, list is available here: https://docs.atlassian.com/DAC/rest/jira/6.1.html

Hope this was useful! If you ever need my help, you can write in comments sections. Also, you can contact me through my LinkedIn Profile.

--

--

Raghwendra Sonu

Software Automation Testing expert with 9 years of work experience in diverse tools and technologies.