Run code at the end of testing

Ranorex Spy, Recorder, and Studio.
npanag
Posts: 33
Joined: Thu Jun 02, 2016 5:42 pm

Run code at the end of testing

Post by npanag » Tue Sep 06, 2016 1:21 pm

I have a project that executes a number of iterations.
One web site calculates some numbers with input data from an Excel file. These numbers are compared to a predefined set of numbers. If the numbers in an iteration are different, a Ranorex.report.error puts a red indicator to this iteration.
The test execution continues and, at the end, some of the iterations have red inidicator and the big circle up and right is green.
What code and in which location of the test can force that if one at least iteration has the Ranorex,report.error raised, then the final big circle up and right to become also red?

Thank you in advance.

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Run code at the end of testing

Post by krstcs » Tue Sep 06, 2016 3:26 pm

Try using Report.Failure() instead of Report.Error().
Shortcuts usually aren't...

npanag
Posts: 33
Joined: Thu Jun 02, 2016 5:42 pm

Re: Run code at the end of testing

Post by npanag » Tue Sep 06, 2016 4:21 pm

Yes, but where do i write it?

If i write it in the user code, it starts until it reaches the Report.Failure() and then stops without iterating the other 5 times. I want all iterations to be done and after the last iteration to run the Report.Failure (if some conditions exist).
Where must i write it?

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Run code at the end of testing

Post by krstcs » Tue Sep 06, 2016 4:25 pm

Have you set the Error Handling option to "Continue iteration" for the test case?
Shortcuts usually aren't...

npanag
Posts: 33
Joined: Thu Jun 02, 2016 5:42 pm

Re: Run code at the end of testing

Post by npanag » Wed Sep 07, 2016 12:20 pm

Yes it worked with changing the Error behavior to "Continue with iteration" and putting in the code the Report.Failure command that influenced the final big circle result. Now for example, in 3 only successful iteration in a total of 6, the final circle is half in green and half in red referring that 3 iterations succeeded and 3 failed.
Thank you.