Ask a Question

How to avoid certain "Stop on Error" scenarios?

SOLVED
TCYKPB
Occasional Contributor

How to avoid certain "Stop on Error" scenarios?

Hello, I have my project configured to Stop on Errors when I run my test cases, but there are some errors which are not functional bugs (very frequently the TestedApps.App.Run() fails to open the desired application and it stops the test). Is there a way to bypass or make the "Stop on Error" property ignore these scenarios? Because if TestComplete fails to open one of my applications, I would like to retry opening it and continue the test, but so far I have tried putting that code inside a "try-catch" (javascript) block, and the test is still stopped, ignoring the "try" block.

1 ACCEPTED SOLUTION

Accepted Solutions
brumazz
Staff

Re: How to avoid certain "Stop on Error" scenarios?

It looks like it will work the same.

 

brumazz_0-1628707578031.png

I hope this helps.

If not I would suggest opening a support case.

 

View solution in original post

12 REPLIES 12
AlexKaras
Community Hero

Re: How to avoid certain "Stop on Error" scenarios?

Hi,

 

 Is there a way to bypass or make the "Stop on Error" property ignore these scenarios?

I am not aware about such option.

You may consider opposite approach - do not stop test on error but use Runner.Stop() / Runner.Halt() methods to stop test when really needed.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
TCYKPB
Occasional Contributor

Re: How to avoid certain "Stop on Error" scenarios?

I have considered that, but I still want to stop on errors when, for example, a Click() in an object fails, or a Checkpoint fails. I just want to avoid the Stop when the TestedApp fails to Run() (or  find a workaround to make it open 100% of the times without errors).

brumazz
Staff

Re: How to avoid certain "Stop on Error" scenarios?

This might be a bit basic, but what about just adding an If..Then statement to look for the needed process to be running.... and if not then launch it.

 
TCYKPB
Occasional Contributor

Re: How to avoid certain "Stop on Error" scenarios?

Hi @brumazz , my code looks something like this:

if not (Sys.WaitProcess("myapp.exe").Exists) {

    TestedApps.MyApp.Run() // <--- Here Test Complete throws an error 4/10 times, and the execution is stopped even if I put it inside a try/catch

}

 

The problem here is how TestComplete manages the errors with the "Stop On Error" option selected (or, to be more specific, the fact that TestComplete throws errors on simple actions as opening an application). It would be great if there is a way to ignore these type of errors, because I could simply manage them by "retrying" one more time the same action until succeeds.

brumazz
Staff

Re: How to avoid certain "Stop on Error" scenarios?

What about changing the playback to retry failed test items?

brumazz_0-1628617554844.png

 

TCYKPB
Occasional Contributor

Re: How to avoid certain "Stop on Error" scenarios?

@brumazz I considered that too, but some of our tests take more than 30 minutes and after that time when an application should be opened to verify something, the "re run" option would add another 30 minutes to the execution just because TC couldn't open an application. 

brumazz
Staff

Re: How to avoid certain "Stop on Error" scenarios?

I'm sorry, I may be confused, but this setting is not going to re-run the entire test....just the failed test step.

 

So, say you have 1 test step that that validates that the app is open.

 

Given you have changed that setting, it would retry the validation...not the entire test.

 

Also, have you tried doing any of this in a KeyWord Test?

 
TCYKPB
Occasional Contributor

Re: How to avoid certain "Stop on Error" scenarios?

Hi @brumazz , I just checked again the stop and re run current item option based on your comments, and I can confirm it does not work as you said. It re-runs the entire test case again. Here you can see the result of running a test that fails in one step: the entire test is re-run after it fails.

TCYKPB_0-1628692382632.pngTCYKPB_1-1628692409318.png

TCYKPB_2-1628692433647.png

 

joaobc
Occasional Contributor

Re: How to avoid certain "Stop on Error" scenarios?

This week I search to edit delay value inside the scrip, and works as well.

I go search again the documentation to help you. Take a look on this reference (https://support.smartbear.com/testcomplete/docs/reference/test-objects/controls/misc/options/index.h...), but I believe you can't edit this property anymore ..

StopOnError

 This property is obsolete. It is supported for backward compatibility only.
Error handling > On error project property. Boolean. Read-only. If the project property is set to Continue running, returns false. Otherwise, returns true.


Check this too (https://support.smartbear.com/testcomplete/docs/working-with/managing-projects/properties/playback.h...)

reading I believe there is a way to edit with a plugin script, but I dont know if works in time of execution

cancel
Showing results for 
Search instead for 
Did you mean: