Skip to Main Content
Return to Navigation

Using Persistent Variables

If you need to store variables between tests, use persistent variables. PTF stores persistent variables to the database so that subsequent test executions can use them.

Persistent variables are stored in the database keyed by execution option name. Persistent variables can also be keyed by User ID, machine name, or both.

There are two key elements required to use persistent variables:

  1. Set the variable action in the test.

  2. Set persistent variable options.

Setting Variable Option in the Test

To set the variable option in the test, use the Test Property icon.

  1. Create a new test or open an existing test.

  2. Click on the Test Properties icon.

    Test Properties

    The test properties icon is located in the Test information group box.

  3. Set the Variable Action field.

    • None (default). The test will not be using persistent variables. All variables set in the test are only global to the current test execution.

    • Read. The test can only read persistent variables from existing persistent variables in the PTF test database.

    • Write.

      The test can only write persistent variables to the PTF test database.

    • Read & Write. The test can read and write persistent variables from and to the PTF test database.

Setting Persistent Variable Options

The persistent variable options are available on the Advanced Options page in Execution Options. You can set the Advanced Options in the PTF client or PIA.

See Configuring Execution Options in PTF Client or Configuring Advanced Options

Managing Persistent Variables

Use the Manage Persistent Variables page (PSPTTSTPERVAR) to modify or delete persistent variables.

select PeopleTools, then select Lifecycle Tools, then select Test Framework, then select Manage Persistent Variables

Image: Manage Persistent Variables page

This example illustrates the fields and controls on the Manage Persistent Variables page. You can find definitions for the fields and controls later on this page.

Manage Persistent Variables page

This page will list all the persistent variables stored in the database. The variable is stored when the test writes the variable to the database.

The variable is always stored with the name of the execution option. The User ID and Machine Name are dependent on the selection you made for the persistent variable on the Advanced Options page of the Execution Options.

You can delete persistent variables or modify the variable value.

Example of a Test that uses Persistent Variables

This example shows a test where the variable action was set to Read & Write in the Test Properties. The variable &userid exists in the persistent variable table.

Image: Example of using persistent variables in a test

This example illustrates reading a persistent variable (&userid) and writing a persistent variable (&role).

Example of using persistent variables in a test