Created On:  02 September 2011


How can I create a Setup or Cleanup Test which will kill a process before or after a test execution?


Occasions may arise where it is necessary to kill a process either before or after a test is executed from SilkCentral Test Manager. For example consider if you had a SilkTest testcase which was testing a Web Application and on occasions the browser would hang at the end of the test; this would have an effect on the next test execution running against a browser because the browser would already be in an unresponsive state. Other examples include, killing the SilkTest Open Agent in order to remove any hooks remaining from a previous SilkTest execution before you execute the next SilkTest test case.

To overcome these types of scenario SilkCentral Test Manager allows you to define a setup and cleanup test for each Execution Plan in order to prepare an environment for a test, the only caveat is that you must create the Setup or CleanUp test prior to assigning them to a test execution. The following example below demonstrates how this can be achieved.

1) From the Tests tab, right click and select “New Child Test”

Create a test of type “ProcessExecutor Test”

2) Provide the name of the executable you wish to use; in this instance it is the cmd.exe and then provide the commend line arguments for execution

In the above instance, the command will kill the SilkTest Open Agent process (OpenAgent.exe)

3) From the Execution Planning tab, select the “Child Execution Plan” then go to the “Startup/Cleanup” tab and edit it to add the test you created in the above steps.

In this example, every time the Test is executed, the Startup test will kill the Open Agent.exe process thus ensuring a clean launch of the Open Agent is launched for the test case.
Incident #2529872