TestLink is a Test Management tool which can be used to manage Test cases and Test plan. Now you can add bug tracking functionality to it by link it to JIRA. This can be done by integrating an API token generated from JIRA and then linking token to a particular test plan in TestLink for a particular project. Now to elaborate on this last state, read below to get a better understanding on how to achieve this in detail.
In order get this started, we need already have a Project created in your JIRA as I would not be covering that here. To learn how to create a project in JIRA Cloud then go here. For linking your JIRA with your testlink you need an API token. In order to integrate third party applications, you need to have some API tokens which would help you integrate your tool or software with the third-party applications, in this case Testlink. Now you need to generate an API token through JIRA. Keep in mind that you need to have an Admin access to generate API Tokens.
API Token Generation in JIRA
To generate an API token, at first you need to log into your JIRA account. Then go to Atlassian account settings which is under Personal settings.
After that select the Security option from the left-hand side and then observe the security page. Under the API token click on “Create and manage API tokens” as you can see below.
An API Tokens page will open which can see below. You can also come to page directly using this URL, https://id.atlassian.com/manage-profile/security/api-tokens, if you are already logged in into your JIRA account.
This is the API Token Atlassian JIRA link or the page where you can generate the page where you can generate the API Tokens which you can see above. JIRA allows a maximum of 25 API Tokens at a time. Click the blue button which says “Create API token”. A pop up will appear where you have to add a token label as per your convenience.
After typing a label select Create. An API token will be generated which you need to copy and save it some place. Therefore our token is generated successfully.
So now we have a new API Token named Testlink JIRA connection (according to the picture below) which has never been accessed before. We have not used this token till now to access any third-party tool or software in this case it is Testlink.
Linking Testlink to JIRA
You need already have a project created in Testlink along with a test suite containing test cases, a test plan and test plan that is already executed. To learn more about TestLink, read our blog on it from here.
Log into your Testlink account. Make sure you are inside of the project to which you want to link JIRA to. Now from the home page of Testlink select “Issue Tracker Management”.
After selecting the Issue Tracker Management option, a new window opens. Now you have to create an issue tracker link here. Click the “Create” button.
A new window with a form opens where you have to fill three types fields which are: Issue Tracker, Type and Configuration. In the Issue tracker field there, you can give any relevant name you want. For instance, I have given Testlink with JIRA as my Issue Tracker name. In the second field named Type, which is a drop-down menu, select the “jira (interface: rest)” option as you can see below.
Lastly, we come to the most important part of this form which is the Configuration. Here you can use the template of the Configuration which I have provided below. You need to copy and paste this template in the Configuration field.
<!-- Template jirarestInterface --> <issuetracker> <username>firstname.lastname@example.org</username> <password>ZIsEMokxYRJnahx5SY1lF3CD</password> <uribase> https://arditesbdltd.atlassian.net/</uribase> <!-- CRITIC - WITH HTTP getIssue() DOES NOT WORK --> <uriapi>https://arditesbdltd.atlassian.net/rest/api/latest/</uriapi> <uriview> https://arditesbdltd.atlassian.net/browse/</uriview> <userinteraction>1/0</userinteraction> </issuetracker>
Now in this template you need to tailor it to your configuration for it to be used by you. I will now explain each of the configuration you need to rewrite. Please refer to the template I have provided above each time I explain a step.
At first you need you use your email address which used to log into your JIRA account. As you can see below, I have used email@example.com in the <username> tag below. Just remove my email and enter yours.
Then in the
<password> tag, you need to provide the API token that you have generated and saved it some place. Just remove my API Token and add your one.
After that in the
<uriview> tags, you just need to change part of the URL. For example in each of our URLs in these tags you can see the https://arditesbdltd.atlassian.net/ part is the same after which the URL changes. You have to change that URL into your jira URL for the tag. JIRA URL can be seen from the picture below (the highlighted portion). You can also obtain your JIRA URL like this.
Below I have highlighted the portions you need to change. Make sure you add your JIRA URL in the highlighted portion.
After you have made required changes in the template and filling out the Issue Tracker Management form in Testlink, click Save. In the screenshot below you can see how I have entered all of the required information in the form.
You can check whether the connection you just created between your JIRA account and Testlink project is working or not by clicking the Check connection button. If the connection is successful then you would be able to see the success message below.
Now click Save. After you have clicked Save, you can see below that a new Issue Tracker named Testlink with Jira has been created.
Now you have to go to your project where you have to link your issues. Go the home page of your project in Testlink and select “Test Project Management”.
There whichever project you want to link with select that project. Here I am selecting the project GB Test Case which you can see below.
So, this window which opens next after clicking the project shows all information and settings related to the GB Test Case project that I have selected.
Now here there is a feature which is called Issue Tracker Integration and as of now it is not Active which you can see above. To link your JIRA to this project, you have to select the Issue tracker drop down and chose the option you have just created. Like the Issue tracker we created just now (Testlink with Jira), select that option. After you have selected your issue tracker link, the Active checkbox (the checkbox on top of the Issue Tracker drop-down) will become active. Now you have to check that checkbox. You can see below, how I have selected my newly created Issue tracker and checked the Active checkbox. Then click on Save.
You have now linked your project with your Issue Tracker. After clicking save you can see below, your Issue Tracker associated with your project. In my case, Testlink with Jira issue tracker is visible with my GB Test Case project.
Linking Bug/Issue to Test cases
Next you have to go to your respective test case where you have to attach your bug or issue. It is important that you have already prepared test suites (which test cases inside) in a test plan which have been executed, if not then you should do that before moving to the next step. The thing is if now a test case fails, you can report an issue directly in JIRA and then link that issue with that failed test. You can also link existing issues in JIRA with your test cases in Testlink.
To accomplish, that first you need to go to your Testlink dashboard. There click on “Execute Tests” option on the right-hand side of the window.
The Execute Tests window opens which you can see below. There on the left-hand side make sure the Test Plan option points to the test plan you have created for your Testlink project (the project you have just linked your JIRA with). In my case it is GBCore test plan which I created earlier and execute the test case inside. You can see below that I have selected GBCore test plan as my Test Plan.
After I have selected my test plan, you can see my test suites associated with my test plan open in the bottom left corner. Select any test suite and the test case inside which you have executed and want to link your issue to. Below you can see that I have selected the test suite Login and the test case “GBTC-4 Valid email Valid pass”. You can then see some option pops up in the right side of the window, which shows execution history and the steps to perform that particular test case.
We will here focus of the Last execution white box which is highlighted in green in the picture below. This section shows the execution history of that particular test case. You can see below that I ran the GBTC-4 test case and it failed for which it is marked in red. Now what we need to do is click on the green bug icon near the Last execution title. I have marked it using a red arrow which you can see below.
Clicking this icon open another tab on your browser. Your JIRA project selection page gets opened when you click on the green bug icon. You can see below that JIRA projects page. Now to create an issue in JIRA click the blue Create button.
After selecting the Create button, a “Create issue” form appears where you have to fill up all the necessary details regarding the bug/issue you are going to report.
You can see the form in the picture below. In the form at first you have to select a project where you want to create an issue. In my case I am selecting “Test Project (TP)”. Then select the Issue type from the drop-down. I have selected it a Bug type. As you scroll down you will find all the common details that you will find while reporting a bug. Like for Summery I am writing it as “Validation bug”. For description I am just writing a test description.
Your description should describe the bug that you are reporting. It should contain all the steps of how that issue occurred and how you can go through that. In reporter I am putting my name Muhtadi as I am the one who reporting. Set the priority as per your convenience. Add any label you want to give. Add an environment name where you are facing this issue. You add an attachment related to the bug you are reporting. Assign the issue to someone here.
There are many such option to fill out here where are essential to do while creating a bug or an issue in JIRA. After al these fields are filled then issue fields are done. Then just click on Create.
Next select your project and go to the “All Issues” section. You can see your issue is created in JIRA as you can see below. In my case my Validation bug can be seen below. Keep a note of the code number of the issue you have just created. Here it is TP-5 for my issue.
After that we go to our Testlink tab and refresh the page. You will be taken to the home page of your project in Testlink. Go to Execute Tests again. Select the test suite and test case again, on which you have been working on. I have selected the test suite Login and the test case “GBTC-4 Valid email Valid pass”. Next, we again focus in the Last execution section. We click another green icon which is located under the Bug management column heading. I have marked it in the picture below.
Another window appear which is titled “Add link to bug report” at the top. This window consists of two input fields. In the “jira (Interface: rest) Bug id” field enter the code number of the issue that you have created in JIRA. I have entered TP-5 for that reason. After that click on Save and then Close.
Now you can see that a new row has been under the execution history of the test case. That is the issue you have created in JIRA. You can see the bug code and name which is TP-5 Validation bug which I have created in JIRA. There you go. You have now successfully linked your JIRA issue with the test case in Testlink.
You can also add more than one issue in the same test case by clicking the green icon in the new JIRA bug column. When you hover over that icon, it should say “Link Existent Issue”. When you click it, you repeat the process of entering the bug code of issue/bug created in JIRA and then clicking save. I have done the same as an example when you can see below.
When you click on the issue, then you will be direct towards your issue/bug that you have created in your JIRA project.