Forum Discussion

rgratis's avatar
rgratis
Frequent Contributor
12 years ago

Help with stopping a Project or Project Suite and running a cleanup routine

I've posted about this before, but I'm still having trouble wrapping my brain around how to accomplish some tasks I want to perform in TestComplete.



I run a Project Suite from the command line, organized something like this:



Project Suite (test run  command calls it)



- Project #1 - Setup

- - Test Item - Setup for Project Suite run (script routine)



- Project #2 - Feature A

- - Test Item - Setup for feature testing (script routine)

- - Test Item - Test #1 (script routine)

- - Test Item - Test #2 (script routine)

- - etc.

- - Test Item - Teardown for feature testing (script routine)



- Project #3 - Feature B

- - Test Item - Setup for feature testing (script routine)

- - Test Item - Test #1 (script routine)

- - Test Item - Test #2 (script routine)

- - etc.

- - Test Item - Teardown for feature testing (script routine)



- Project #4 - Teardown

- - Test Item - Teardown and reporting for Project Suite run (script routine)





There are a few different error cases I want to catch:



1. There's an error in the Project Suite Setup at the beginning.  I want to export the test log, email a failure notification, and then stop the entire test run (Project Suite).



2. There's an error in a Setup routine for a given project.  I want to run the project teardown/cleanup routine and then stop the project.



3. Errors within a project reach a critical level, which I've been tracking via a Project Variable.  Because the feature appears to be having a mass failure, I want to run the project teardown/cleanup routine and then stop the project.



The first one I've accomplished through scripting, but if there's a better way to do it using TestComplete's "Stop on error" and Events, I would like to know.



The last two I'm stuck on.  How do I stop a project while still managing to execute that project's teardown routines to clean up the feature testing?



Any help is appreciated.

2 Replies

  • rgratis's avatar
    rgratis
    Frequent Contributor
    No, I ended up doing overly complicated scripting to work around this.  I basically capture and log all errors and have a script that I call when I want to stop the project/suite.  The script runs any cleanup routines and then halts the test run.  I don't have my project or suite set to stop on error with TestComplete settings.