Send the result of a Postman request to a linked Vansah Test Case. This example runs your assertions, records Passed or Failed, and checks that Vansah saved the Test Run.
Before you begin
Create a Test Case linked to the Jira work item you want to test. The account needs Jira space access and Vansah permission to execute Test Cases.
Copy your Vansah API Connect URL and create a Vansah API token. Keep the token private.
Each enabled request creates a new Test Run. This example records an overall result; it does not upload each assertion as a Vansah step log.
1. Configure a Postman environment
Create or select an environment.
Add the variables below with values from your own Jira space.
Keep reporting disabled while editing.
Variable | Value | Purpose |
| Your API Connect URL | Base URL without a trailing slash. |
| Your private API token | Direct Authorization header; no Bearer prefix. |
|
| Existing linked Test Case. |
|
| Existing Jira work item. |
|
| Disable or enable reporting. |
|
| Optional environment name; supply if mandatory. |
|
| Optional existing Jira release name; supply if mandatory. |
|
| Optional existing Jira sprint name; supply if mandatory. |
These screenshots show an older layout. Copy your own workspace URL; the host shown is an example.
2. Add the post-response script
Endpoint: POST /api/v2/run
Open the request and select Scripts → Post-response (called Tests in older Postman versions). Add the script below and replace the two sample assertions with checks for your API.
Put every synchronous assertion that should affect the Vansah result inside check(...). This example does not aggregate assertions elsewhere, collection-level or asynchronous checks, or requests that receive no response.
let result = "passed";
function check(name, assertion) {
pm.test(name, function () {
try { assertion(); }
catch (error) { result = "failed"; throw error; }
});
}
// Replace these checks with the assertions for this request.
check("Response status is 200", () => pm.response.to.have.status(200));
check("Response time is below 2 seconds", () =>
pm.expect(pm.response.responseTime).to.be.below(2000));
if (String(pm.environment.get("sendResultstoVansah")) === "1") {
const read = name => String(pm.environment.get(name) || "").trim();
const urlValue = read("Vansah_URL");
const baseUrl = urlValue.endsWith("/") ? urlValue.slice(0, -1) : urlValue;
const token = read("VANSAH_TOKEN");
const caseKey = read("VANSAH_CASE_KEY");
const issueKey = read("VANSAH_ISSUE_KEY");
if (!baseUrl || !token || !caseKey || !issueKey) {
throw new Error("Set the Vansah URL, token, Test Case key, and Jira work item key.");
}
const properties = {};
for (const [field, variable] of [
["environment", "EnvironmentName"],
["release", "ReleaseName"],
["sprint", "SprintName"]
]) {
const name = read(variable);
if (name) properties[field] = { name };
}
const payload = {
asset: { type: "issue", key: issueKey },
case: { key: caseKey },
result: { name: result },
properties
};
pm.test("Vansah saved the Test Run", function (done) {
pm.sendRequest({
url: baseUrl + "/api/v2/run",
method: "POST",
header: {
Authorization: token,
"Content-Type": "application/json",
Accept: "application/json"
},
body: { mode: "raw", raw: JSON.stringify(payload) }
}, function (error, response) {
try {
if (error) throw error;
pm.expect(response.code).to.equal(200);
const body = response.json();
pm.expect(body.success, body.message).to.equal(true);
pm.expect(body.data.run.key).to.be.a("string").and.not.empty;
console.log("Vansah Test Run:", body.data.run.key);
done();
} catch (reportError) { done(reportError); }
});
});
}
For multiple requests, give each its own Test Case mapping. A collection-level script with one shared case key creates runs for that same case after each request.
3. Run and verify
Select the environment and set
sendResultstoVansahto1.Send the request. Check your API assertions and Vansah saved the Test Run in Test Results.
Open the linked Test Case in Vansah and verify the run, result, and properties.
Set reporting back to
0while changing the script.
Rerunning creates another run. If reporting times out, check Vansah before retrying because the run may already have been saved.
Troubleshooting
Problem | What to check |
No run | Selected environment, reporting enabled, exact keys, case linked and not blocked. |
Authentication or permission error | Token validity, workspace URL, Jira space access and execute permission. |
Validation error | Current workspace result names, exact existing release/sprint names and mandatory properties. |
API checks pass; reporting fails | Review the separate reporting assertion and response message. API success does not prove the result was saved. |
For Test Folder or Test Plan runs, use the shapes in Create a Test Run. Do not put a folder path in the Jira work item variable.
Postman references: post-response tests and sending requests from scripts.


