Don't seem to be able to kill a test case anymore

Ranorex Spy, Recorder, and Studio.
carsonw
Posts: 178
Joined: Tue Nov 08, 2011 10:01 pm

Don't seem to be able to kill a test case anymore

Post by carsonw » Fri Dec 14, 2012 10:01 pm

If we encounter a fatal error (i.e. an application fails to launch), we throw a certain type of exception that should terminate the entire test case execution.

This doesn't seem to work anymore (I'm on ranorex 3.3.4, cannot update to ranorex 4.0 yet because the reporting changes are causing problems for us).

Instead of terminating the test case, the test iteration continues, but they continue with some very strange behaviour.

This is how we are trying to terminate the test case:

Code: Select all

TestReport.EndTestCase(Ranorex.Core.Testing.TestResult.FailedStopped);
Are we doing it wrong? It used to work once upon a time. How should we do it now? Thanks for your help!

Carson.

carsonw
Posts: 178
Joined: Tue Nov 08, 2011 10:01 pm

Re: Don't seem to be able to kill a test case anymore

Post by carsonw » Tue Dec 18, 2012 10:06 pm

As a follow up, the following seems to be happening (i.e. the strange behaviour):

* The test does not actually terminate, it continues
* The reporting is very strange, iterations are no longer reported, the "iteration x of y" is gone and they are now equal with the test case level instead of underneath it on the report
* Start getting a lot of "object reference not set to an instance of an object" errors that we do not get otherwise
* Test cases that should be reported as "skipped" (i.e. they are greyed out), instead show as passed even though they never ran.

This is causing problems for us, because tests that should fail quickly are instead running ages and ages. For example, if I cannot launch the application I should fail and the test is over. Instead, every iteration (and there may be 100s) tries to run, and with no application it just sits and waits to find every element which, of course, fails. So it can take many hours when it should be killed in a matter of seconds.

This did work before, so hoping for some insights here. Thanks!

Carson.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Don't seem to be able to kill a test case anymore

Post by Support Team » Wed Dec 19, 2012 4:16 pm

Hello,

'TestReport.EndTestCase()' is used to stop the report but not the test case.
You could simply throw an exception to kill a test case (as shown in the example below):
throw new ValidationException("Validation failed!");
Regards,
Markus (T)
.
Image

carsonw
Posts: 178
Joined: Tue Nov 08, 2011 10:01 pm

Re: Don't seem to be able to kill a test case anymore

Post by carsonw » Wed Dec 19, 2012 5:41 pm

We're catching exceptions and managing them - so we should throw an unhandled one? It's strange because this worked before.

Also, won't that just end the iteration, not the entire case (i.e. if I have 100 datarows in this test case, and a fatal exception happens on row 4, I don't want to run rows 5-100, I want the entire case to terminate.

EDIT: Yes throwing that exception only aborts that row, not the entire case. The console actually says the module is being aborted (which I take to mean the test case), but it's not, just the current test on the data row is aborted.

The API document ion suggestions that the method I was originally calling should do the trick (which I reiterate we've been happily using until now): http://www.ranorex.com/Documentation/Ra ... Case_1.htm

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Don't seem to be able to kill a test case anymore

Post by Support Team » Thu Dec 20, 2012 3:51 pm

Hello,

I assumed you want to stop the whole test.
'TestReport.EndTestCase()' is not a legal method to end a test iteration.

Could you please provide more information on this issue?
Are you using Ranorex Studio (Test Suite) or Ranorex API?
Which Ranorex version did you use before to stop a test case?

Could you please send us your code to [email protected] in order to reproduce this issue?

Regards,
Markus (T)
.
Image

carsonw
Posts: 178
Joined: Tue Nov 08, 2011 10:01 pm

Re: Don't seem to be able to kill a test case anymore

Post by carsonw » Thu Dec 20, 2012 5:49 pm

This is one of the challenges that I see with the use of terminology, some of us use the terms test suite, case, iteration differently. I'm not looking to terminate just the iteration (by which I mean, a row in the datarow in the databindings), but I'm looking to stop the entire test case, meaning the test case defined in the test suite rxtst file, and throwing an exception does not do that (throwing an exception just stops the iteration).

I know I could set the reporting in the test suite to stop on failure, but I don't want that either because most failures don't require a full stop, only certain ones do.

As for the version, I can't say. Fortunately we don't have fatal errors often, but we have them now and they destroy our entire test. I would have to uninstall my current version, install an old version, and keep trying until it works the way I expected.

In the comments for the method "TestReport.EndTestCase(Ranorex.Core.Testing.TestResult.FailedStopped);" it says that it removes the current test case activity from the activity stack and updates the test result... hence my confusion. I can zip up our code and send it over...