Can i pass "CSV" file value in collection runner test result text

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;
 }
}

Hey @jayaveljays,
Could you specify the problem that you are facing?

If I want to access any value specified in the CSV that the runner uses, I could do that in the test by using the special data variable. More here

Could you maybe share a sample of the CSV you have uploaded and what you’d like to test?

Thanks,
Meena

1 Like

If I understand what you’re trying to do, you want to display the value from the Transactions column in your csv as the test name in your request?

If you want to use a variable in a test name, you can use backticks for string interpolation like you have in your request 1 tests:

pm.tests(`Transaction: ${pm.iterationData.get('Transactions')}`, function(){
  pm.expect(pm.response.text()).to.include('extIn_fscd_request');
});

If that’s not what you want, would you mind sending screenshots of the collection runner results and describing what you expect?

Also, it’s probably worth noting that transactions is misspelled a couple of times in your test scripts above. That might contribute to some of the issues you are having.

Thanks @allenheltondev, your understanding is correct. and code works fine thanks