Jumping to next test case using secondary Thread
Posted: Tue Aug 30, 2016 3:29 pm
Hello fellow Ranorex ,
I'm trying to create an "Error Inspector". This module basically creates a thread that monitors an unexpected error, such as a message on the screen. To identify this error , the code will send a command to jump to the next test case.
Below the code I had created to do this.
Unfortunately, each ways demonstrated on both methods failed , each one crashes Ranorex.
I'm trying to thread throws exception and its jumps to next iteration or just use Ranorex method to jump to next iteration .
Any idea to solve this situation?
I'm trying to create an "Error Inspector". This module basically creates a thread that monitors an unexpected error, such as a message on the screen. To identify this error , the code will send a command to jump to the next test case.
Below the code I had created to do this.
Code: Select all
public void StartErrorVerifier()
{
try {
Thread tErrorV = new Thread(errorVerificator);
tErrorV.IsBackground = true;
tErrorV.SetApartmentState(ApartmentState.STA);
tErrorV.Start();
} catch (Exception) {
throw;
// Report.Error("ErrorInspector - Error launched");
// throw new RanorexException("ErrorInspector - Error launched");
// Ranorex.Validate.Fail("An error message was showed until test execution.");
}
public static void errorVerificator(){
while (true) {
if (repo.SmilesOMelhorProgramaDeMilhasS1.ErrorMessage_GenericInfo.Exists(Duration.FromMilliseconds(5000))) {
Report.Screenshot();
Report.Failure("An error message was showed until test execution.");
return;
#############################################
// throw new Ranorex.ValidationException("An error message was showed until test execution.");
// #############################################
// Ranorex.Validate.Fail("An error message was showed until test execution.");
// return;
// #############################################
// throw new RanorexException();
}
}
}
}
I'm trying to thread throws exception and its jumps to next iteration or just use Ranorex method to jump to next iteration .
Any idea to solve this situation?