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 “[” “]” .