Need after check "mark http erros as warnings" the script be PASSED

Idea ID 2798211

Need after check "mark http erros as warnings" the script be PASSED

In some aplication that we are testing, it is normal to get some error code like 403 or 422. In these cases we mark the transaction as "Pass" using the "lr_set_transaction_status(LR_PASS)"

For avoid these situation, we have used "lr_continue_on_error" to be able to continue executing the script and "lr_set_transacion_status (LR_PASS)" to mark as "PASS" the transaction.

But with these 2 workaround, we have continue our script running and we have put the transaction to PASSED but our script status still been FAILED.

We need a function to change the final script status to PASSED if we have changed any transaction to from FAILED to PASSED.

7 Comments
Micro Focus Frequent Contributor
Micro Focus Frequent Contributor

Hi @Huriz 

I think you missunderstood "continue on error" and "mark http erros as warnings".

As you explained you set the transaction to "Pass" by force, and check on "continue on error" to make the script continue executing.

The web step was still "falied". It makes sense.

 

If you want to skip http errors, you need to check on "mark http erros as warnings" in RTS > "Preferences".

If you don't want to skip all web http steps but only specific step(s), you can add

API web_set_rts_key to enable the setting before the issue step, and disable it after.

For example,

web_set_rts_key("key=HttpErrorsAsWarnings", "Value=1", LAST);
web_url("error_page_warning",
                   "URL=https://nghttp2.org/httpbin/status/404",
                    LAST);
web_set_rts_key("key=HttpErrorsAsWarnings", "Value=0", LAST); 

 

Regards,

Wei-Wei Zhang

Super Contributor.
Super Contributor.

hi @Wei-Wei Zhang 

 

We have tried you possible solution, but for us it could be a workaround. we can not control the error code from the http request.

 

If we know that a request will answered us with known error code, we can apply your workaround, but if we dont know what we will receive, and depending what answer we receive we need the script be FAILED, your solution is not applayable

 

thank you very much for your help 🙂

Micro Focus Expert
Micro Focus Expert
Status changed to: Waiting for Votes
 
Micro Focus Frequent Contributor
Micro Focus Frequent Contributor

Hi @Huriz 

You don't have to know the specific error code.

"HttpErrorsAsWarnings" will make all http error code as warning, including 403 404 4xx and so on...

If your requirement is 

lr_start_transaction("DoSomething");
web_url("step1",...);

web_url("step2"...);

...

web_url("stepN"...);
lr_end_transaction("DoSomething", LR_PASS);

to make "step1"~"stepN" ignore http errors and "pass".

 

I think

lr_start_transaction("DoSomething");

web_set_rts_key("key=HttpErrorsAsWarnings", "Value=1", LAST);//Enable HttpErrorsAsWarnings
web_url("step1",...);

web_url("step2"...);

...

web_url("stepN"...);

web_set_rts_key("key=HttpErrorsAsWarnings", "Value=0", LAST); //Disable HttpErrorsAsWarnings

lr_end_transaction("DoSomething", LR_PASS);

meets your requirement.

 

I said "404" in my last comment just for example.

It doesn't mean HttpErrorsAsWarnings only works for 404 or specific error code.

 

If your requirement is "only bypass 403 and 422, and mark other code as failed".

That will be an enhancement of HttpErrorsAsWarnings , because it has no block list or allow list up to now.

 

Let's make it clear that the requirement is

"I don't want http errors make script failed for some reason"

or

"It's nothing to do with http or web steps. I just want make the script result be SUCCESS"

 

Regards,

Wei-Wei Zhang

Super Contributor.
Super Contributor.

Hi @Wei-Wei Zhang 

I understand you solution, but for us is a workaround. We can apply this time due to we know that there always we are going to have a error code.

 

But imagine that you have a request, and depending the return code we need to put as error or as warning.
Example:
404, 400, 501 we need to be error
300,401 we need to be warning.

with your solutin, you are forcing that all returned codes be warning. and this is why for us is a workaround and not a solution.

regards

Micro Focus Frequent Contributor
Micro Focus Frequent Contributor

Hi @Huriz 

Yes, that's my point.

If there's a block list or allow list for HttpErrorsAsWarnings in RTS or API

For example

web_set_rts_key("key=HttpErrorsAsWarnings", "Value=1", LAST);//Enable HttpErrorsAsWarnings

web_set_rts_key("key=BlockList", "Value=404,400,501", LAST);//HttpErrors as warnings except for 404 400 501

or

web_set_rts_key("key=HttpErrorsAsWarnings", "Value=1", LAST);//Enable HttpErrorsAsWarnings

web_set_rts_key("key=AllowList", "Value=1**,3**,401", LAST);//HttpErrors as warnings only for 1XX, 3XX,401

Will that meet your requirement?

 

Regards,

Wei-Wei Zhang

Super Contributor.
Super Contributor.

hi again @Wei-Wei Zhang 

if we have what you said, it will be fantastic and it will cover our needs.

With you solution we can control what error allow or block, thats for us will be a solution.

 

regards and thanks you very much 

 

 

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.