JIRA Automation Part 1: Introduction

jira1-4_cover-no-type.jpg

JIRA Automation Part 1: Introduction

How automation saved the day

How to stop worrying and love automating JIRA: all the reasons, ingredients and steps you need.

Why, for goodness’ sake?

Okay, so you find yourself in your comfort zone and you don’t want things to change, right? It seems quite easy: you execute your automated tests, verify results and report them manually to JIRA. Your whole team congratulates you on a job well done, the product has been deployed, the client is quite pleased and everyone goes home to live happily ever after. The story is over.

happy-qa-tester.jpg

However, the first night after the greatest victory of your life, you seem uneasy. You can’t sleep, you can’t rest because you believe you could’ve done even better. Quicker. Drenched in sweat, you ask yourself one question: WHY DIDN’T I AUTOMATE JIRA AS WELL?!

Of course, this is just a silly fictitious tale, you would never NOT automate JIRA. You know why? Because it makes things quicker, smoother and, ultimately, easier. And that’s exactly the reason why we did it. It doesn’t take much time to set the whole thing up, especially after you’ve got a hold of everything, and maintenance is even easier.

By now, you must be wondering what JIRA automation actually means in this case. Well, in short, it means that you can connect your automated test output (a.k.a. results) with JIRA so that when you perform your test suites, your test tasks in JIRA are automatically set as either “PASS” or “FAIL”. We’ll say more about this later in the article.

It should be emphasized that our JIRA automation recipe is not the only way of doing it and it may not be the best one either, but it works, and that was good enough for us. We do encourage you to find better solutions and share them with us. Also, it is worth noting that we expect our readers to know, at least vaguely, what JIRA is used for (no, you don’t have to be a JIRA expert to understand this article). 

Let’s see the ingredients we’ll be needing to perform JIRA automation.

Ingredients

JIRA automation, the way we did it, requires several tools and some of them may not be actually free, but the logic behind using them is always the same and can be applied to other similar tools as well.

Our ingredients are:

  • A big empty bowl called JIRA which will be filled with XRay extension tasks

  • Cypress testing tool with several Mocha reporter extensions which will be used to process XRay tasks as automated tests. 

  • VS Code IDE which will be used to extract test output details from Mocha report and mix them into a concoction which will be poured in the JIRA bowl.

  • Postman app which will be used to get the JIRA-ready JSON report in the JIRA bowl.

Let’s do more explaining here. XRay extension is basically just a test case management app which is integrated into JIRA. It gives you options for creating test plans, test sets, tests, etc. as JIRA tasks with JIRA ID. This will be the basis of your JIRA automation. 

Mocha extensions will be used to generate JSON reports on test results. We will not go into many details about Mocha extension here, they will be properly explained as we move on. VS Code and Postman probably don’t need an introduction - they are standard tools for development (VS Code) and API testing (Postman).

WorkFlow

We’ll talk a bit about JIRA automation workflow. This is just an overview of the whole procedure which will be explained specifically later on. It will be useful to have all the steps in one place to get a clearer picture of what we’ll be doing.

Our workflow has 8 steps, 4 of which are required and 4 optional ones:

Required:

  • Step 1: Creating tasks (XRay test plan, test execution, test tasks, etc.)

  • Step 2: Executing Cypress tests + exporting results to JSON files

  • Step 3: Extracting data from one JSON file and creating a new JIRA-ready JSON file using that data

  • Step 4: Updating JIRA tasks by sending JSON file through a JIRA REST API endpoint (using curl command)


Optional:

  • Step 1: Bootstrap data (Postman collection)

  • Step 2: Merging multiple JSON files into one with all data (only when multiple suites are featured)

  • Step 3: Cleaning up unnecessary leftover files (which were originally exported after Cypress testing)

  • Step 4: Verifying everything has been updated correctly in JIRA.

Let’s see how this works visually.

jira-automation-workflow.png

What next?

In the next part of the article, we will explain how to create and structure all the necessary tasks in JIRA - from the test plan to the single test. We will also explain the purpose of these tasks in the whole JIRA automation picture.

Frane RogosicComment