Join 34,000+ subscribers and receive articles from our
blog about software quality, testing, QA and security.

JIRA gadgets for TestRail


#1

The JIRA gadgets for TestRail source code has been released open source (https://github.com/zenoss/testrail-jira-gadgets). A few notes:

  • All active statuses and their colors are pulled from the TestRail server (using the API)
  • Custom statuses are handled
  • Since the gadgets are standalone rather than a plugin, installation and configuration are manual
  • The standalone gadgets don’t do dynamic dropdowns, so Perl scripts were created to periodically update the XML files with the current active projects, test plans, etc.
  • The gadgets do not automatically refresh; refresh occurs any time the browser page is refreshed. Also, if the browser is resized or the dashboard layout changed then the browser must be refreshed to resize the gadget. JIRA also caches the requests so updates in TestRail are not immediately displayed in the gadget. (The delay is 1-2 hours, unless the cache is cleared.)
  • Access to the TestRail server is required to install the files
  • JIRA administrator access is required to add the gadgets to the gadget directory
  • As noted in the license, the software is distributed on an “AS IS” basis, without warranties or conditions of any kind, either express or implied.

See the link above for installation instructions (INSTALL.md).

Here are two screenshots. They both are using a couple of custom statuses for example purposes, and both show the popup information when you mouse over the chart data.


Feature request: JIRA plugin for 2-way links
Get all the results of a run with get_results_for _run
#2

Hello Don,

That’s great, thanks for sharing this! Looks impressive and is a great addition to the existing JIRA integration features. Is this JIRA Server only or does this work with JIRA Cloud as well?

Cheers,
Tobias


#3

For JIRA Cloud I think your TestRail server has to be accessible via HTTP/HTTPS externally, but it should work.


#4

Hi Don,

Cool, thanks again :slight_smile:

Cheers,
Tobias


#5

A few minor bug fixes have been checked into the github repo this week.


#6

I take it that this is only for TestRail Server rather than TestRail Cloud? Are there any future plans for JIRA Gadgets for TestRail Cloud?


#7

Hello Paul,

I believe this is independent of a TestRail edition and works with both TestRail Server/Cloud (as this only uses TestRail’s API). I’m not so sure about the JIRA edition though, as it also requires server-side Perl scripts from my understanding and this might only work if you have full control over JIRA and use JIRA Server.

Cheers,
Tobias


#8

Just to clarify … the Perl scripts can be run anywhere, as long as API calls to the TestRail server can be made from the machine. However, the gadgets assume all of its files (.js, .png, etc.) reside on the TestRail server, so in my instance the Perl scripts run on the TestRail server.

It might be possible to run them on a standalone web server, and have the files stored there, and make a few changes to the XML (and possibly the Javascript) to look for the Javascript and images on this other web server instead of the TestRail server.

NOTE: The reason the XML has to be on a web server is because adding the gadget to the list of available gadgets on your JIRA server requires a URL.


#9

Thanks, Don!

Cheers,
Tobias


#10

I checked in a change to the github repo linked above. I added a user preference in the XML files called gadgetURL so that you can store the gadget files on a web server other than your TestRail server. (The Perl scripts would also be run there.) This will help those who are using a hosted TestRail instance.

The installation instructions (INSTALL.md) have also been updated.

NOTE: The gadget server (as I call it) must be accessible via HTTP/HTTPS from your JIRA server. If your JIRA server is using HTTPS, the gadget server must be, too. And, if you’re using HTTPS, a signed SSL certificate works much, much better. The gadget server also must be able to access the TestRail server via HTTP/HTTPS because the Perl scripts make API calls to the TestRail server to generate some of the dynamic XML files.

Let me know if you have any questions or problems.


#11

That’s great, thanks Don!

Cheers,
Tobias


#12

Thanks a lot for this work Don, I’m going to give this a try, I’ll get back to you with my results…


#13

I don’t post for every minor fix, but I did check in a significant change to the Daily Activity and User Activity gadgets. The API call get_results_for_run paginates the results, and if your test plan had more than 250 results then they weren’t all being added to the totals. This has been fixed by using filters and offsets on the API call.


#14

Thanks, Don!

Cheers,
Tobias


#15

I’ve not had any luck with this @donalaya due to the fact that we have JIRA Cloud and you now can’t add custom gadgets to your directory. I have to contact Atlassian support but I’m not sure if this is going to be something that they will support.

I’ll update you if I hear anything positive back from Atlassian regarding this.


#16

There was a minor cosmetic change to the gadgets checked in, and I updated the Perl script that generates the XML for the milestone gadget to handle sub-milestones.


#17

Thanks, Don!

Cheers,
Tobias


#18

Hi There !

Just came across this beautiful work you guys did and I love to use it, but:

After following the install.md file I was able to run and execute all of the perl files on my Gadget server, and XML files were created.
All XML files were also added to Jira Gadgets directory and I can see and add them to my Jira Dashboards.

BUT !
When I add a gadget to my dashboard I get the following message:
"Unable to retrieve the list of statuses"
See attached a screenshot of the gadget inside Jira and the Gadgets directory containing the testrail gadgets

My configuration is:

  1. Jira Server v6 configured as HTTP
  2. local Gadget server - RedHat7 running httpd - HTTP
  3. Testrail cloud - HTTPS

Jira server can access both TestRail cloud and Gadget server
Gadget server can access both TestRail cloud and Jira server

Please let me know how can I solve this issue as I would really appreciate using these gadgets
If any logs are needed, I’ll happily provide them.

Thanks,
Moshe


#19

That error usually means the TestRail URL is incorrect in the XML file OR the user credentials in the JavaScript file is incorrect. So,

  1. Edit the XML file(s) in the gadgets and the templates directory on your gadget server and verify the TestRail URL is correct.
  2. Edit the JavaScript (.js) files in the gadgets directory on your gadget server and verify the credentials in the setTestRailHeaders() function is set correctly. By default it is set to user:pass and it needs to change to a username (i.e. email address) and password that is valid for your TestRail instance.

If those are set correctly and you’re still getting the error then run the following from your gadget server, replacing <TESTRAIL_URL> with the TestRail URL you have in your gadget XML and and with the credentials you have in your JavaScript files:

curl -v -H "Content-Type: application/json" -X GET -u <user>:<pass> <TESTRAIL_URL>/index.php?/api/v2/get_statuses | python -m json.tool

NOTE: The python part of that command is to format the JSON output.

If that fails then please post the error here.


#20

Hi @donalaya !

Thanks for your comment and sorry for my late response - I did not get email notification on the thread…

User name and password are set correctlly.
Running the attached curl provided good output

And the issue remains…

Any thoughts of what else ?

Thanks,
-M