0

I'm using LoadRunner Vugen (Virtual User Generator) to implement a C script and I am a bit puzzled because I'm getting this result:

enter image description here

Usually when I use some functions like

web_reg_find()
web_reg_save_param_regexp()
web_custom_request()

the flow interrupts if a HTTP error code comes in, but I needed to process data and treat some errors as normal situations using a code inside the response body, so I changed some of the parameters in order to do so.

But now is not clear to me what to do for making the script pass or fail as I wish. I already succeed with the transaction using:

lr_end_transaction(NOMBRE_TRANSACCION, transactionResult);

where transactionResult evaluates to LR_FAIL or LR_PASS depending on my needs, but I don't know which rules apply for making the script behave the same as the transaction. I tried returning different int values from the Action.c main body. I looked also in the docs but maybe I'm not searching properly, because I found nothing.

I just want to know which rules apply to force manually a LR vugen script to pass or fail.

Thanks in advance.

madtyn
  • 1,469
  • 27
  • 55

2 Answers2

1

Rule of thumb, if your request winds up in the HTTP error log on the server, then it will wind up a fail in LoadRunner. 4xx & 5xx are considered to be error conditions which show up in the log. 3xx is navigation/governance. 2xx is success. 1xx is informational. So, the rules are set by the w3c for HTTP status codes. LoadRunner simply respects the standard.

Your developers should not use HTTP status messages for their app. They should pass back App error messages in a valid HTTP 2xx response. This is why you check for expected results, which is standard part of any experiment in the scientific method. For any request to the system, you have an expected response condition. You should check for that response. If you do not receive that response, even with an HTTP 200 response which is within your response time requirements, you still have a failure as the application is not responded in a method for which the expected output is present for a given input.

As you are now presumably engaging in "continue on error," you may not need to set the condition to fail. The status of the transaction should still be fail, unless you wish to change it to LR_PASS based upon some logic.

James Pulley
  • 5,606
  • 1
  • 14
  • 14
  • Developers shouldn't use HTTP status codes, but they do and we have no power over them. Our only choice is to look at a code inside the 404 and determining if the error can be considered a lack of performance or just lack of data at the database. – madtyn Feb 17 '21 at 16:09
  • 1
    Yes, you do have control over them. You can fail them in QA for using HTTP status codes for application status. This is a functional question. If it does not work for one then it should not progress to being assessed for many in a performance test – James Pulley Feb 19 '21 at 19:56
1

the "script passed" was reported because there is probably no actual error. you just set the transaction to fail. Without any error thrown by vugen itself it considers any script passed, no matter what the transaction status is set to.

errors in vugen:

  • any wrong use of lr functions (eg. wrong number of arguments OR invalid arguments)
  • a request timed-out
  • on http-error-codes (4** and above)
  • web_reg_find failed to find text in response
  • weg_reg_save_param failed to save param from response

..but what vugen reports here doesn't matter anyway. when LR_FAIL is used with lr_end_transaction, the transaction will be reported as failed in the final report. there is no such thing as a "script passed" statement in any report. Its just a Vugen thing.

Transactions should only fail if there is an actual error. Only, in some rare cases the transaction status must be set manually.

Use Textchecks

It is always a good idea to use textchecks to validate any response!

web_reg_find("Text=text indicates valid response", LAST);

if text is not found the transacrion will fail and an error message is printed.

To make a transaction fail if http-code is ok but in the response is an error message use:

web_reg_find("Text=error message indicates invalid response", "Fail=Found", LAST);

if text is found the transacrion will fail and an error message is printed

br41nst0rm
  • 31
  • 4
  • I know about errors, but developers of an application are sending back a 404 when data is not found at the database. We are testing performance, but a 404 for no data found at database is not revealing a lack of performance in any way, so I have to distinguish by an error code they are sending within the 404 body. – madtyn Feb 17 '21 at 16:06