Page 1 of 1

Programatically checking and unchecking scripts in a test suite.

Posted: Wed May 15, 2019 4:19 pm
by ian807
Hello,

I'd like to programmatically check and uncheck scripts in my test suite depending on whether the script passes and fails so that I can run a fail suite automatically at the end of a run (not just re-running a failed script). Is this possible in version 9.0.1?

Thanks in advance for any help.

Re: Programatically checking and unchecking scripts in a test suite.

Posted: Wed May 15, 2019 7:46 pm
by Support Team
Hi Ian,

This is possible, but I am not sure if it is the best approach to this scenario. As a best practice, your test cases and suite should utilize [TEARDOWN] regions to clean up the AUT and environment for the next run. The [TEARDOWN] regions will always run, even if there is an error in the middle of the test.

If you wish to continue on your current path, you can dynamically set a test containers checked state in code. This allows you to change the test suites flow during runtime. Note, this must be called before the test container is started.

Code: Select all

TestSuite.Current.GetTestContainer("NameOfTestContainer").Checked = true;
Also, you may be able to take advantage of Run Configurations (create a run config for your custom teardown). You can easily set the desired run configuration at runtime via the /rc command line argument.

I hope this helps!

Regards,
Ned