hi team, please find the below code.
I have two requests, for each request I have test scripts, in first request i am getting an data called “Transcations” from csv file. i need to add this value in the second request test section as
"pm.test("Transaction", function () {
pm.expect(pm.response.text()).to.include("extIn_fscd_request");
});"
so that transcations value from csv data will be displayed in the collection runner result for each iteration, right now transcations are considered as a pretext
Tests for request 1:
var response = pm.response.json();
for (var i=0; i < response.length; i++)
{
if (response[i].freitext.includes(`${pm.iterationData.get("Transcations")}`))
{
pm.collectionVariables.set("processInstances", response[i].processInstanceId);
pm.test("Successfully transferred the processInstanceId", function () {
pm.response.to.have.status(200);
});
break;
}
else
{
pm.collectionVariables.set("processInstances", 0);
}
}
Tests for request2:
var response = pm.response.json();
pm.test("Transactions", function () {
pm.expect(pm.response.text()).to.include("extIn_fscd_request");
});
for (var i=0; i < response.length; i++)
{
if(response[i].name.includes("extIn_fscd_request"))
{
pm.test("transactions", function () {
pm.expect(response[i].value).not.eql(null);
});
break;
}
}
pm.test("transactions", function () {
pm.expect(pm.response.text()).to.include("extIn_icm_provisionsdaten");
});
for (var j=0; j < response.length; j++)
{
if(response[j].name.includes("extIn_icm_provisionsdaten"))
{
pm.test("transcations", function () {
pm.expect(response[j].value).not.eql(null);
});
break;
}
}