Skip to main content
All CollectionsAPI & IntegrationsIntegrations
Integrate Postman Tests with Vansah Test Management for Jira
Integrate Postman Tests with Vansah Test Management for Jira
Updated over a month ago

Learn how you can integrate Postman Tests with Vansah Test Management for Jira.

Prerequisites

  • Postman Test Collection (Download a sample Postman Collection with an example of the instructions below)

  • Vansah is installed in your Jira workspace

  • Vansah connect token to authenticate with Vansah APIs.

Configuration

  1. Add Vansah URL into Postman Env. variables : Obtain your Vansah Connect URL from Vansah Settings > Vansah API Tokens

Add Vansah_URL in your Postman Environment Variables (We recommend using Postman Environment variables)

2. Setting Environment Variables : Store your Vansah API token as an Postman environment secret variable for security.

3. Add Test Run Properties (Optional) : Add Sprint, Release, and Environment details to Postman Environment variables to ensure that the Vansah Test Run contains information about Sprint, Release, and Environment.

Implementation

To enable Vansah Integration into your Postman API Collection, follow below steps:

1. Add AssetDetails variable in the Postman Env variables which will have either Jira Issue Key or Test Folder details.

2. Add Result variable in your Tests tab

This result variable will hold the result of “Failed” or “Passed” and will get updated whenever a Postman Test function gets failed or shows an error.

To enable the update of result variable we need catch the error and update the result to “Failed” and then throw the same error just like below.

3. Add API request to send Results to Vansah

a. Add sendResultstoVansah variable in the Postman Environment variables : Note: we’ve added this variable to deactivate sending results when user is updating the tests. (add `0` to deactivate)

b. Add this script below to your Tests

Now add your Test Case Key in the Payload.

// Vansah - Sending API Test results to Vansah
if (pm.environment.get('sendResultstoVansah') == 1) {
// Variable to deactivate sending results when the user is updating the tests. Set to 0 to deactivate.
//Test Run Properties Object
let properties = {};

// Add properties if they are not empty
addPropertyIfNotEmpty("environment", pm.environment.get('EnvironmentName'));
addPropertyIfNotEmpty("release", pm.environment.get('ReleaseName'));
addPropertyIfNotEmpty("sprint", pm.environment.get('SprintName'));

const sendResults = {
url: pm.environment.get('Vansah_URL') + '/api/v1/run',
method: 'POST',
header: {
'Authorization': pm.environment.get("VANSAH_TOKEN"),
'Content-Type': 'application/json'
},
body: {
mode: 'raw',
raw: JSON.stringify({
"case": {
"key": "TEST-C10"
},
"asset": {
"type": "issue",
"key": pm.environment.get('AssetDetails')
},
"result": {
"name":result
},
"properties": properties
})
}
};
// Function to add properties if they are not empty
function addPropertyIfNotEmpty(propertyName, propertyValue) {
if (propertyValue && propertyValue.length > 0) {
properties[propertyName] = {
"name" : propertyValue
}
}
}
// Send the request
pm.sendRequest(sendResults, (error, response) => {
console.log(error ? error : "Result sent to Vansah - TM");
});
};

Conclusion

By following the above steps, your Postman Collection will be equipped to send Test Run results directly to Vansah, streamlining your testing and reporting process.

Ensure that all variables are placed and configured as described to facilitate successful integration.

For Vansah specific configurations and API details, please refer to the Vansah API documentation.

Did this answer your question?