Creating or Editing ProcessExecutor Tests

To create or edit a ProcessExecutor test:

  1. In the menu, click Tests > Details View .
  2. Select a container or folder node in the Tests tree where you want to insert a new test, or select the test that you want to edit.
  3. Click New Child Test (New Child Test) on the toolbar, or click (Edit).

    The New Test/Edit Test dialog box appears.

  4. Type a name and description for the test.
    Note: Silk Central supports HTML formatting and cutting and pasting of HTML content for Description fields.
  5. If you are creating a new test, select ProcessExecutor Test from the Type list box. Click Next. The ProcessExecutor Test Properties dialog box appears.
  6. In the Executable Name field, type the fully qualified name of the executable.
  7. In the Argument List field, type all arguments of the process executor test method.
    Note: Multiple arguments must be on separate lines in the field.
  8. Set the Working Folder. This is the folder where the executable is executed.
  9. If the executed command produces JUnit test result files, for example an Ant or Maven JUnit execution, you can specify a folder pattern that is scanned for JUnit result xml files. The folder location is relative to the working directory, for example test-results. The root folder where the search starts is the Working Folder, in which all JUnit output files where the path contains the entered pattern are retrieved.
During execution of the executable the following two environment variables can be used:
Environment Variable
Description
SCTM_EXEC_RESULTSFOLDER
All files in this folder are saved as result files in Silk Central. If an output.xml file is created during execution in this directory, it is processed by Silk Central.
SCTM_EXEC_SOURCESFOLDER
This is the folder where all source files used during the execution are located.
Note: To define these environment variables as arguments for a test, use the predefined parameters that are available for all test types, instead of using the specific environment variable that is only available for ProcessExecutor tests. For example, use #sctm_test_results_dir instead of SCTM_EXEC_RESULTSFOLDER.

Examples

To configure a ProcessExecutor test that runs the Windows Script Host from the command line with the /c switch and two parameters, specify the following:

  • /c - A command that specifies that the command line should terminate after execution.
  • cscript - The Windows Script Host.
  • parareadwrite.js - The jscript file.
To run the test on a Linux server, you can use the following Python script:
#!/usr/bin/env python
#
import sys
import os
print 'command and arguments: ' + str(sys.argv)
print 'SCTM_EXEC_RESULTSFOLDER: ' + str(os.environ.get('SCTM_EXEC_RESULTSFOLDER'))

Instead of using the environment variable SCTM_EXEC_RESULTSFOLDER, you can set the predefined parameter #sctm_test_results_dir as an argument in Silk Central. The argument will be replaced with the corresponding environment variable when the script is executed.