Forum Discussion
Thanks but Runner.Stop or Runner.Halt will stop the whole test,but I want to exist one test iteration and continue with other then how can I do it ?
Example :- There are 3 actions such as Login, Action1 and Logout
I have created all this 3 action in Script and then created Keyword test and calling each of this action. Now I have data driven this now suppose first iteration runs fine and the second iteration (meaning second data row in excel) where it has issue in Action1 then I can stop that test iteration and then move to 3rd iteration. In UFT,we have ExitTestIteration which does this thing. What is possible in TestComplete?
Regards,
Nimish
Hi,
There is no any solution from the box. You should implement your own customized method.
- tristaanogre8 years agoEsteemed Contributor
Utilize exception handling (try/catch/finally) within your test cases. When something happens that you need to halt the test case, raise an exception using whatever code language or methodology you're using, let the "Catch" handle the exception, and let the test run continue on with the next test case. You are correct, Runner.Halt() will halt the whole run... so you need to find other ways of doing it. AS baxatob mentioned, you should work out whatever custom method will work best for your needs.
- nimishbhuta8 years agoFrequent Contributor
Hello,
The thing is I have structured my test in this way, for example test case name is TC01_CreateOrder and in that case there different action which is Login, Create Order and Logout. My datasource is in Excel file which is named as TC01_CreateOrder and has 2 rows.
In TestComplete, I have created subroutines in the script for each action i.e Login, CreatOrder and Logout and then created one Keyword test called TC01_CreateOrder and then calling each sub routines.
In each subroutine, I have raised an exception but if the exception is found say in Login then I don't need to continue Create Order and Logout for the 1st row but need to continue for the 2nd row. How can I can exit the first iteration such that it does not go to other action such as CreateOrder and Logout.
I am not able to find any solution on it. Is there any way we can solve this?
- tristaanogre8 years agoEsteemed Contributor
Right.. as mentioned, raise an exception in Login but don't HANDLE it in Login (in other words, Login does not utilize try/catch/finally). Then, in your test case TC01_CreateOrder that calls Login, wrap the whole test case in Try/Catch/Finally logic. So, when the exception is raised in Login, it "bubbles up" to TC01_CreateOrder... the exception than triggers the "Catch" logic which then skips the rest of the test case. This is precisely what we do and it works every time... our test case stops and we go on to the next test case.