Hi Team,
I am using csv file to iterate request multiple times with different sets of data but issue occurred as below:
During the 1st iteration, specific field have some values but during the 2nd iteration, that specific field does not have any value(its blank).
Step to reproduce:
csv file
1st Iteration fields-seniorCoachTeamscurrentCount, seniorCoachTeamstarget, seniorCoachTeamsavatarUrls blank, Doesnât have any value.
2nd Iteration Fields: seniorCoachTeamscurrentCount, seniorCoachTeamstarget, seniorCoachTeamsavatarUrls have values.
Response:
1st iteration:
{
âorderingEntitiesâ: [
{
âcurrentCountâ: 45,
âtargetâ: 10,
âavatarUrlsâ:
}
],
âseniorCoachTeamsâ: ,
}
2nd iteration response:
{
âorderingEntitiesâ: [
{
âcurrentCountâ: 0,
âtargetâ: 5,
âavatarUrlsâ:
}
],
âseniorCoachTeamsâ: [
{
âcurrentCountâ: 0,
âtargetâ: 5,
âavatarUrlsâ:
}
],
}
Code:
1st solution -working fine, No error
pm.expect().to.include(pm.iterationData.get(âseniorCoachTeamscurrentCountâ));
2nd solution -not working ,error as below snap
pm.test(âdata rankidVerificationâ, function () {
var jsonData = pm.response.json();
var str = jsonData.seniorCoachTeams;
var regex = RegExp(â,â);
if (regex.test(str))
{
console.log(jsonData.seniorCoachTeams);
}else
{
pm.expect(jsonData.seniorCoachTeams[0].target).to.eql(data.seniorCoachTeamstarget);
}
P.S. Due to editor view, In the code you might be see square () but those are brackets â[â â]â .