top of page
hand-businesswoman-touching-hand-artificial-intelligence-meaning-technology-connection-go-

Automation Jira with API

As we all know Agile Methodology is a process for developing software.


To implement this methodology, we use Jira tool. Jira was designed to manage End to End project implementation but originally it was designed for a Bug and issue tracker.

Jira is smooth flow of Agile Methodology

Jira provides Scrum and Kanban Boards that are highly customizable

The JIRA dashboard consists of many useful functions and features which make handling of issues easy.

Jira developed by an Australian based software company known as Atlassian Corporation Inc.

Below is the website to learn more about them https://developer.atlassian.com/


Jira is used for?

Jira is used for the following purpose

  1. Requirement Management

  2. Test Case Management

  3. Project Management

  4. Product Management

  5. Task Management

  6. Bug Tracking

  7. Software Development

Here, we can use three different ways to use the Jira tool

  1. The first way, we can update directly in the Jira tool is by creating the project and raising the bugs or defects in create issues where we can prioritize the test case and as well comment. In summary we can see the details about the issue created.

  2. The second way, we can do it in postman manually and give the username and password, with the help of these credentials we can create the issue and comment as well. We can pass the comment in body in JSon Text.

  3. The third way, we can automate the same whatever we did in postman manually by using Rest Assured given().when().then()

What is Jira issue?

JIRA issue would track bug or issue that underlines the project. Once you have imported project then you can create issues.

Under issues, you will find other features like

Issue Type, Workflow,Screens, Fields


Now, Let see how we can automate Jira with API

1st Step:

Download/Install the Jira server in your local system for API Testing.

2nd Step:

After downloading successfully, we need to signUp with Username and Password in Jira Software/Tool

3rd Step:

Select the Create new Project by selecting Scrum Software Development and click Next

We can see the below screen



Click the selecte button and we navigate to the below screen



In this give your Project Name ( Eg: i gave here is numpy) , Key will generate in Key field automatically and click submit


By doing these steps it creates a Key for the project we need to use that Key for our automation (Eg: NUM is the key for this)


4th Step:

For better understanding, I am using here postman to do this manually and will automate the same

  1. In the post, HTTP gives the base URL (I gave my local host Jira URL) and pass the JSON body with your Jira User name and password once you send the request it generates the name and value



2. Create an issue by using the post method (I gave the URL as mentioned in this document https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/). In the header specify the name and value generated while doing 1st above step. Pass the JSON body with the required fields which mentioned in the document. Please find the screen-shot below of how it links to Jira manually



For reference, the bug which we created in Postman can be seen in the Jira tool as well


So, this is how we do it manually in Postman.

Automate Jira for API Testing:

Whatever we did in Postman manually we automate the same in Rest Assure

Create a class, in that class, we use given (), when (), and then ().

How to create issue?

In given (), we need to give the base URL, header, and body (in the body we pass the Username and Password)

In when () we use the parameter with post and then we extract the response.

To pass the above response we use given (), path param, and will pass the key and value generated, and in the body, we need to pass the required fields as a JSON text.

Please find the below clear coding we need to give in Rest Assure

Example:

public class JiraTest {

public static void main (String[]args) {

RestAssured.baseURI="XXXXXXXXXXXXXXXXX ";

String response=given().

header("Content-Type","application/json").

body("{ \"username\": \"XXXXXXXXXXXXXX \", \"password\": \"XXXXXXXXXX \" }")

.log().all().filter(session).when().post("pathparameter").then().log().all().extract().response().asString();

given().pathParam("XXXXXXX","XXXXXXXX").log().all().header("Content-Type","application/json").

body("{\r\n"

+ " \"body\": \"This is my first cooment\",\r\n"

+ " \"visibility\": {\r\n"

+ " \"type\": \"role\",\r\n"

+ " \"value\": \"Administrators\"\r\n"

+ " }\r\n"

+ "}").

when().post("pathparameter ").then().log().all().assertThat().statusCode(201);

}


}


We can also create issue directly in Jira Tool as well Manually

To create agile issue, go to main menu under Agile tab, click on “Getting Started”, when you click on it, it will ask to create new board for the issues for Scrum or Kanban. You can choose your option as per your requirement, here we have selected Scrum method.





Conculsion:

Jira tool is used as a road map to develop the software and due to the different features it will help to track the End to End Implementation and can make any changes acoording to client requirements when required.

We can use this method for our easy-to-raise or track the bug and defects. In this we have different methods like comment the defects, update the defect by using Put Method, Create the defects by using Post Method, to see the update we can also use Get Method.

276 views0 comments

Recent Posts

See All

Beginner Friendly Java String Interview Questions

Hello Everyone! Welcome to the second section of the Java Strings blog. Here are some interesting coding questions that has been solved with different methods and approaches. “Better late than never!”

留言

評等為 0(最高為 5 顆星)。
暫無評等

新增評等
bottom of page