- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Stop execution & perform clean-up
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-17-2009 03:17 AM
Hi,
I have a test suite, this calls (Exec.run) other test cases. Say, In a test case, if some unexpected result is received, I would like to stop the execution of the test case there, call a clean-up procedure and then move on to execute other test cases.
How can I implement this in iTest?
Our observation:
AbortExecution aborts entire execution and not just test case.
AbortTest sets the status of test case as Abort, but executes the complete test case
Regards
Aswin
Re: Stop execution & perform clean-up
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-17-2009 09:13 AM
While a testcase is running another testcase using EXEC.Run, the calling testcase has no control over what happens to the other testcase other than a timeout. So every testcase has to take care of aborting itself when it fails. That means you will have to appropriately put analysis rules in your called testcase to abort execution when you think the testcase needs to abort.
We are adding an event in a future version of iTest called: OnFailTest, OnPassTest, etc... so that users can override one global event for a testcase to do whatever they want when a testcase fails - but even this approach has to be used for each testcase - the calling testcase using EXEC.Run still does not have any control over the called testcase.
Having said that, there is an expensive workaround currently.You can use global analysis rules to call a procedure which does "summarize" and aborts if the testcase status is failed. This analysis rule will run on each step. Global analysis rules can be added to a session profle, a testbed or testcase. Again the parent testcase will not be controlling this - the testcases themselves have to be written to abort based on certain conditions.
Re: Stop execution & perform clean-up
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-17-2009 09:14 AM
First, let's look at the individual test that you are running from the master test. The individual test defines its own behavior. When there is a failure, you configure that test itself about whether it should abort or not when there is a failure. If the test itself needs to clean up after itself, then you can also configure an event handler to call a clean up procedure if you want.
Now let's look at the master test case. The EXEC.run step that runs the individual test produces a response that provides information on how that test ran. You can add analysis to that step if you want to take certain actions depending on the outcome of that test. For example, on a failure, you can call a cleanup method before moving on to the next test. If you want that same rule to apply to all of your EXEC.run steps, you can add a global rule to do the same thing.
AbortExecution and AbortTest actions are designed for controlling the currently running test. You may want these in the individual test, but it sounds like you do not want these in the master test. In the master test, it sounds like you want to use analysis on the EXEC.run steps to take special actions depending on the outcome.
Re: Stop execution & perform clean-up
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-17-2009 10:35 PM
Yes, I want cleanup in the current test case & not the master test case. As you said, I want to call the cleanup procedure as an event handler. Along with this, when the test case sees that the DUT has got some critical errors, instead of continuing the execution, I would like to stop the execution of the test case there, don't execute remaining steps of the test case and move forward to execute other test cases.
I need an event like AbortExecution for a test case. The current AbortExecution stops the entire test-suite execution and just a test case.
Re: Stop execution & perform clean-up
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-17-2009 10:51 PM
Re: Stop execution & perform clean-up
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-17-2009 11:21 PM
Aswin
Are you sure that you do not have abort execution in the master testcase?
Anyway - I think you can use global analysis rule in your child testcases to stop execution whenever your testcase status changes to failed. This global analysis rule simply calls a procedure which does following:
EXEC.summarize
if status = failed
call clean up procedure
endif
You can use this global analysis rule in all your child testcases by putting it in appropriate session profile, testbed or in each child testcase.
Re: Stop execution & perform clean-up
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-17-2009 11:54 PM
Hi Paul & Kumar,
My observation was wrong. AbortExecution action in a test case is aborting that test case & not the master test. I re-checked again now before raising it as an issue. I think we had messed up with call & run. Thanks for your time.
