Page History
...
Pre-request scripts may be useful as a means to initialize some data before the test or to implement some test setup code.
Variables can be defined at multiple levels and can be used to make maintenance easier; the sample applies to authentication, which can also make use of variables.
Integrating with Xray
Integrating with Xray, in order to have visibility of API testing results in Jira, can be done by simply submitting automation results to Xray through the REST API or by using one of the available CI/CD plugins (e.g. for Jenkins).
This can be achieved using Newman and one of its reporters capable of generating a JUnit XML file.Authentication
Requirements
- Postman
- Jenkins plugin (optional)´
...
Then we need to decide which Newman reporter to use. Newman provides a built-in JUnit reporter; however, better alternatives exist such as junitxray or junitfull.
Expand | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||
|
Code Block | ||||
---|---|---|---|---|
| ||||
npm install -g newman # install one of the following ones npm install -g newman-reporter-junitxray npm install -g newman-reporter-junitfull |
...
A Test Execution will be created containing results for all tests executed. Actually, in our specific case and only for demonstration purposes, two Test Executions would be created due to the fact that we're generating two JUnit XML files from the different Newman reporters.
Unstructured (i.e. "Generic") Test issues will be auto-provisioned the first time you import the results, based on the identification of the test (see notes for possible Newman reporters above). The "Generic Definition" field on the Test issue is used as a way to uniquely identify the test.
...
Info | ||
---|---|---|
| ||
Tests will be reused on subsequent result imports as long as you don't change what contributes to the calculation of the test's unique identifier (i.e. "Generic Definition" field); otherwise, new Tests will be auto-provisioned. Therefore, and depending on the Newman reporter being used, if you change the Postman test description or the folder containing the test, it will lead to new Tests in Jira as Xray will consider them to be new. |
In this example, we're looking at the Test Execution (and related Tests) created w
Within the execution screen details, you can look at the Test Run details which include the duration, overall result, and also any eventual error message.
Info | ||
---|---|---|
| ||
If you would use "newman-reporter-junitfull", you would obtain many more Test issues as seen ahead. Some of these Tests would have the same Summary as it would be populated from Postman test's description. |
Tips
- After importing results, you can link Test issues to existing requirements or user stories, so that you can track coverage on real-time directly on them
- You can map Postman's environment to Xray's Test Environment concept on Test Executions if you want to have visibility of the results on a per-environment basis
- Multiple iterations/executions can be linked to an existing Test Plan, whenever importing the results