Overview
In this tutorial, we will create some API tests using Katalon Studio.
Katalon Studio is a free tool that allows you to create an run automated Web, API and mobile tests using a UI that simplifies the writing of tests for non-developers.
Please note
Katalon Studio is able of generating JUnit XML reports and this makes it possible to process and see those results in Xray.
Requirements
- Katalon Studio
Description
Katalon provides some sample projects, so you may create one using them as basis.
One of these templates is the "Sample JIRA API Tests Project", that includes a bunch of Jira REST API related test cases.
The new project will have some sample Test Suites, such as the Test Suites > Smoke Tests > Issue tests.
Katalon is able to run the tests in console mode, enabling the generation of a JUnit XML report. Katalon's project and test suite must be identified along with the report folder path.
./katalon -runMode=console -projectPath=/Users/smsf/Katalon\ Studio/exp2.prj -reportFolder=/tmp/ -reportFileName="report" -testSuitePath="Test Suites/Smoke Tests/Issue tests" -retry=0 -browserType=Chrome
After running the tests and generating the JUnit XML report (e.g., JUnit_Report.xml), it can be imported to Xray (either by the REST API or through the Import Execution Results action within the Test Execution).
curl -H "Content-Type: multipart/form-data" -u admin:admin -F "file=@/tmp/JUnit_Report.xml" "http://jira.example.com/rest/raven/1.0/import/execution/junit?projectKey=JIRAPI"
Each test case is mapped to a Generic Test in Jira and the Generic Test Definition field contains the full path of the Test within the "Test Cases" meta-folder in Katalon Studio.
In the Execution Details of the Generic Test, as the Context within the Results section, contains information about the full path of the Test Suite.