Programatically checking and unchecking scripts in a test suite.

Ask general questions here.
ian807
Posts: 6
Joined: Wed May 08, 2019 7:57 pm

Programatically checking and unchecking scripts in a test suite.

Post by ian807 » Wed May 15, 2019 4:19 pm

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.

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

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

Post by Support Team » Wed May 15, 2019 7:46 pm

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
.
Image