Replaying a Keyword-Driven Test with Specific Variables

Before you can set the values of variables for the execution of a keyword-driven test, you have to create the project.

To set the values of global variables for all executions of a keyword-driven test asset, where these executions are triggered by you, use the Global variables grid of the Run Configurations dialog box. For additional information, see Replaying Keyword-Driven Tests from Eclipse.

When executing keyword-driven tests that are part of an automation framework and that are managed in a test management tool, for example Silk Central, you can set the values of any variables that are used for the execution of the keyword-driven test in Silk4J. To set the values of global variables for the entire project, which means that these values are used whenever a Silk4J user executes the keyword-driven test assets in this project, perform the following actions:

  1. In the Package Explorer, expand the project which includes the keyword-driven tests that you want to execute based on the variables.
  2. Right-click the folder src of the project and select New > File. The New File dialog box opens.
  3. Type globalvariables.properties into the File name field.
  4. Click Finish. The new properties file opens.
  5. Add new lines to the file to specify the variables.
    The format for a new variable is:
    name=value
    For example, to specify the two variables user and password, type the following:
    user=John
    password=john5673

    For information about the format of a properties file and how you can enter UNICODE characters, for example a space, see Properties File Format.

  6. Save the globalvariables.properties file.
  7. Open the keyword-driven test that you want to execute.
  8. In theKeyword-Driven Test Editor, edit the parameters to use the new variables. Use the following annotation:
    ${variable name}
    For example, in the following keyword-driven test, the ${current user} parameter uses a global variable:

Whenever a keyword-driven test in the project is executed from Silk4J, the variables are used.