1

I have 1 request which need authentication before it. Authentication executes one time at start and each time when request return code 403. Code of second auth looks like next:

int rc;
lr_start_transaction("trans");
lr_continue_on_error(1);
web_custom_request(...); // [1]
lr_continue_on_error(0);
rc = web_get_int_property(HTTP_INFO_RETURN_CODE);
if (rc == 403){
  authentication(); // custom action which authenticate user
  web_custom_request(...); // same as [1]
} else if (rc != 200){
  lr_stop_transaction("trans", LR_FAIL);
}
lr_stop_transaction("trans", LR_FAIL);

But when I start this test, I see error in first run of request [1], which I don't want to see, how to make it PASS if second request of [1] is successfull?

Lunigorn
  • 1,340
  • 3
  • 19
  • 27
  • This is quite unusual server authentication. According to the standard, it should return the code 401, and LoadRunner can handle this by means of `web_set_user()`. 403 is considered as error. – tserg42 Jul 06 '16 at 08:30
  • If you do the authentication first and it's already authenticated will it interfere with the web_custom_request? - Or if it is a login page you goto to authenticate, maybe go there, and if the login page isn't shown (your home page is) then skip it. – Brian Folan Jul 06 '16 at 14:09

2 Answers2

0

In the recent versions of LoadRunner, you can open the Runtime Settings (F4) and tip the option Internet Protocol -> Preferences -> HTTP -> Mark HTTP errors as warnings. This will make LoadRunner ignore HTTP errors, but you'll have to handle them manually using web_get_int_property(HTTP_INFO_RETURN_CODE).

tserg42
  • 322
  • 3
  • 8
  • This is very uncomfortable suite, there are a lot of other request which I don't want to check manually. – Lunigorn Jul 06 '16 at 11:46
  • @Lunigorn, unfortunately, this is the only way to avoid generating error on 403 status code. – tserg42 Jul 06 '16 at 12:50
0

Perhaps it would be easier to find out what is generating the 403 and then proactively handle it so you don't receive the initial failure? This way, no error and the manager reading the report will not be incensed by an error in the report.

James Pulley
  • 5,606
  • 1
  • 14
  • 14
  • Unfortunately there is application logic, 403 error happens when session outdated, and then it need to auth again. – Lunigorn Jul 07 '16 at 03:52
  • "....session outdated...." It reads like you are not correlating all of the session/state/date/time tokens appropriately – James Pulley Jul 07 '16 at 14:30