Cancel a test, after popup apears

Ask general questions here.
Posts: 19
Joined: Fri May 03, 2019 8:55 am

Cancel a test, after popup apears

Post by Johann » Wed Jul 31, 2019 1:27 pm

I have to finish my test failed when a popup appears.
We use an error handler, that apears in many cases.
I can find this error handler using PopupWatcher, but i can't cancel that test.

Posts: 19
Joined: Fri May 03, 2019 8:55 am

Re: Cancel a test, after popup apears

Post by Johann » Fri Aug 02, 2019 10:01 am

I've almoust found the solution to my problem.
If the error handler occurs, PopupWatcher starts a CodeModule.
In the CodeModule I try to create a PDF and send it by e-mail.
Then I start a script to close my AUT.

It also works, but got that exception:

Code: Select all

PDF could not be created. Error: System.ArgumentOutOfRangeException: The index was out of range. It must not be negative and smaller than the collection.
Parameter name: index
 for System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
 for System.Collections.Generic.List`1.get_Item(Int32 index)
 at Ranorex.AutomationHelpers.Modules.ReportToPDFModule.GetTestSuiteStatus() in E:\RanorexProjekte\TESTVERSION\RanorexAutomationHelpers\UserCodeCollections\ReportToPDFModule.cs:Line 229.
 for Ranorex.AutomationHelpers.Modules.ReportToPDFModule.UpdateError() in E:\RanorexProjekte\TESTVERSION\RanorexAutomationHelpers\UserCodeCollections\ReportToPDFModule.cs:Line 212.
 for Ranorex.AutomationHelpers.Modules.ReportToPDFModule.CreatePDF() in E:\RanorexProjekte\TESTVERSION\RanorexAutomationHelpers\UserCodeCollections\ReportToPDFModule.cs:Line 124.
 for TESTVERSION.CodeModule.Errorhandler.Behavior() in E:\RanorexProjects\TESTVERSION\TESTVERSION\CodeModule\Errorhandler.cs:Line 98. 
In Line 98 -> Pdf myPDF.CreatePDF();

I have not received a status from the report, how can I set the status to "Fail" or create a "Failed" report?