-2

I need to reproduce the Race conditions scenario where same API is giving multiple response . Here we need to compare the API response and end it as fail transaction if the response are not matching or different from the original response.

Need help on how to script this on load runner tool. I am able to capture the response and save it as a parameter. But how do I compare it with the original response?

Also the response is in JSON format and hence I was not able to use the STRCMP function.

2 Answers2

0

You have an expected response as a string. You have a captured response as a string. You compare two strings. Just make sure you have all of the same formatting characters in your expected result as you have in your captured response

James Pulley
  • 5,606
  • 1
  • 14
  • 14
0

Found the solution.

if (strcmp(lr_eval_string("{pComparisonString}"),lr_eval_string("{response}")) == 0)

{

lr_end_transaction("transaction", LR_PASS);

} else
{

lr_output_message("The parameter value is %s", lr_eval_string("{pComparisonString}")); lr_end_transaction("transaction", LR_FAIL);