Abort entire test in a test run...

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

Abort entire test in a test run...

Post by carsonw » Tue Feb 21, 2012 8:13 pm

Is there a way to programmatically abort an entire test within a test run, while still running subsequent tests?

Unfortunately we cannot use the built in SetUp / Teardown functionality since they would all have to be in the same test case and we cannot bind multiple sources to the same test case (posted on that before, it's really a problem for us and we are doing our best to work around it).

This means we need to do our own version of setup/teardown. What I need to be able to do is if a certain condition is met, to abort the particular test (i.e. some key setup component fails).

However, I still want other tests within the test run to still be executed. Hopefully what I'm asking is clear, I've attached a screenshot to try and further illustrate what I'm asking.

As a suggestion, if you could bind data based on the code module that is contained within the test case, instead of binding data on the test case itself this would solve virtually all our problems. Honestly, I'm finding the current implementation of the databinding really restrictive and frustrating. Just my two cents :)
Attachments
Abort.jpg
Abort.jpg (364.04 KiB) Viewed 2340 times

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

Re: Abort entire test in a test run...

Post by Support Team » Thu Feb 23, 2012 11:03 am

Hi,

You have to change the error behavior of your test cases. Therefore please take a lock to following documentation
http://www.ranorex.com/support/user-gui ... html#c3028

To abort a TestCase via code you just have to throw a Ranorex Excpetion
throw new RanorexException("yourMessage");
or use
Report.Failure("yourMessage");
But in your case you have to replace the Folders to a testcase, because folders are only logical separator for your testsuite and they doesn't affect the run.

Regards,
Peter
Ranorex Team
.
Image

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

Re: Abort entire test in a test run...

Post by carsonw » Fri Feb 24, 2012 7:23 pm

Hi thanks for your response. We've found that we've had to change the approach of our testing because tests in the tests suite were not managed how we expected.

Initially we had thought that we could have multiple tests in the suite, separated by folders but that simply does not work for a number of reasons.

As such, we've changed our approach so that each test will have to reside in its own project. In time, we will likely have hundreds of tests in the same solution (I hope there's not a limitation there).

So that solves some problems, but since we can't use the set up / tear down functions (because of the data connector limitations), we're still having to manage that on our own.

I still need a way to programmatically abort a test in the test suite - is this not possible at this time?

Some pseudo code to illustrate what I am trying (along with the attached screenshot)

Code: Select all


for each (TestCase case in TestSuite)
{
    if (case.name !="TearDown")
    {
         case.AbortThisCaseSomehow;
    }
}
If I could do that, then I could kill all the tests except the tear down one.
Attachments
AbortSomehow.jpg
AbortSomehow.jpg (197.8 KiB) Viewed 2316 times

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

Re: Abort entire test in a test run...

Post by Support Team » Wed Feb 29, 2012 11:13 am

carsonw wrote:Initially we had thought that we could have multiple tests in the suite, separated by folders but that simply does not work for a number of reasons.
Is there a specific reason not to use (parent) test cases instead of folders to group/organize test cases like Peter suggested in his previous post?
That way, you could use setup/teardown modules and also had the error behavior of the test case available.
carsonw wrote:I still need a way to programmatically abort a test in the test suite - is this not possible at this time?
Please, see Peter's last post explaining the options you have to abort a test case/suite. Aborting should not be a problem, however, branching (conditional execution of test cases) is currently not supported.

Regards,
Alex
Ranorex Team
.
Image

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

Re: Abort entire test in a test run...

Post by carsonw » Wed Feb 29, 2012 11:18 pm

I can't recall if we tried the parent/child test case set up. Putting them into their own projects solved some other problems for us as well, but I will try that approach with those that have the preconditions and the like. Thanks!