Updated on 2024-06-06 GMT+08:00

Global Variable Management

Directory Search

  1. Log in to the CodeArts PerfTest console and choose PerfTest Projects in the left navigation pane.
  2. Click the name of the desired PerfTest project to go to the details page.
  3. On the Cases tab, select the created test case in the case list on the left, and click Global Variable.
  4. Select a search type. You can search for global variables by name, variable value, description, or all.

    Figure 1 Search

  5. Enter a keyword in the search box and click the search icon on the left of the search box.

Copying a Variable

Prerequisites: You have created a variable.

  1. Log in to the CodeArts PerfTest console and choose PerfTest Projects in the left navigation pane.
  2. Click the name of the desired PerfTest project to go to the details page.
  3. On the Cases tab, select the created test case in the case list on the left, and click Global Variable.
  4. You can copy variables in either of the following ways:

    • Click in the operation list of the variable to be copied.
    • Right-click the row where the variable to be copied is located and click Copy.

  5. After is displayed in the operation list, click to copy the variable to the root directory. If a variable folder has been created in the variable directory, is also displayed in the variable folder operation list. You can click to copy the variable to the variable folder.
  6. Click Save.

Copying a Variable Folder

Prerequisites: You have created a variable folder.

  1. Log in to the CodeArts PerfTest console and choose PerfTest Projects in the left navigation pane.
  2. Click the name of the desired PerfTest project to go to the details page.
  3. On the Cases tab, select the created test case in the case list on the left, and click Global Variable.
  4. You can copy a variable folder in either of the following ways:

    • Click in the operation list of the variable folder to be copied.
    • Right-click the variable folder to be copied and click Copy.

  5. After is displayed in the operation list, click to copy the variable folder to the folder, and click to copy the variable folder to the root directory.
  6. Click Save.

Encrypting Variable Values

When the global variable type is Ciphertext (encryption type), the variable value must be encrypted. If the global variable type is changed to encryption, you need to manually update the test case that references the variable for the encryption variable to take effect.

  1. Log in to the CodeArts PerfTest console and choose PerfTest Projects in the left navigation pane.
  2. Click the name of the desired PerfTest project to go to the details page.
  3. On the Cases tab, select the created test case in the case list on the left, and click Global Variable.
  4. Create a variable or select a created variable and set the variable type to Ciphertext.
  5. Click Encrypted. In the displayed dialog box, enter the content to be encrypted and click Encrypt to generate a key.

    Figure 2 Variable encryption

  6. Click Copy. After the message Copied to clipboard successfully is displayed, click the variable value text box and paste the generated key to the variable value.
  7. Click Save.

Importing Variables

  1. Log in to the CodeArts PerfTest console and choose PerfTest Projects in the left navigation pane.
  2. Click the name of the desired PerfTest project to go to the details page.
  3. On the Cases tab, select the created test case in the case list on the left, and click Global Variable.
  4. Click Import. In the displayed dialog box, add the JSON file and click OK.

Exporting Variables

Prerequisites: You have created a variable.

  1. Log in to the CodeArts PerfTest console and choose PerfTest Projects in the left navigation pane.
  2. Click the name of the desired PerfTest project to go to the details page.
  3. On the Cases tab, select the created test case in the case list on the left, and click Global Variable.
  4. Click Export. The created global variables are saved to the local host in JSON format.

Inserting Global Variables

When adding request information, enter $$ in the text box to display the global variable list and click the required global variable.