TEARDOWN within Iterations

Ranorex Spy, Recorder, and Studio.
AccidentReport
Posts: 76
Joined: Tue Dec 04, 2012 2:30 pm

TEARDOWN within Iterations

Post by AccidentReport » Tue Jan 07, 2014 12:48 pm

I'm just trying to get some clarity here about when the TEARDOWN will run within a test iteration. Please see the test structure below:

ParentTestCase
---[Setup]
---ChildTestCase1
---ChildTestCase2
---ChildTestCase3
---[Teardown]

As you can see I'm using a parent test that then contains a number of child tests as well as the setup/teardown. The test iterates on the parent test case meaning that it will run setup, child1, child2, child3, teardown each iteration. Fine when it works. But what about when it errors? The ParentTestCase is set to "Continue with iteration" on error, and teh ChildTestCase's are set to "Continue with parent" on error.

My question is will the Teardown run if one of the ChildTestCase's fail? I am assuming that it doesn but from watching my tests run it down not seem to be the case (either that or I've got a bug that needs sorting). Can someone please confirm so I know for sure?

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

Re: TEARDOWN within Iterations

Post by krstcs » Tue Jan 07, 2014 2:37 pm

Setup and Teardown run every time, regardless of the status of the test cases.

It is similar to (and probably actually is in the background) a try...catch...finally, where the finally section is executed no matter what happens in the try/catch areas.
Shortcuts usually aren't...

AccidentReport
Posts: 76
Joined: Tue Dec 04, 2012 2:30 pm

Re: TEARDOWN within Iterations

Post by AccidentReport » Wed Jan 08, 2014 4:05 pm

I thought so. Just wanted it confirming before I started to rely too heavily on an incorrect assumption.