Updated on 2025-11-17 GMT+08:00

Procedure

  1. Log in to the CodeArts PerfTest console, choose PerfTest Projects in the navigation pane, and click Create Test Project.
  2. In the displayed dialog box, enter a test project name (for example, Web-test), and click OK.
  3. Click the name (Web-test) of the created test project to access its details page. On the Cases tab page, you can view the default directory and sample cases that are automatically generated.
  4. On the Cases tab, click Global Variables.
  5. Add a global variable. You can directly add global variables of the integer, text, or enumerated type, or add file global variables with CSV or XLSX files.

    • Adding an integer, text, or enumerated global variable
      In the Global Variable dialog box, click Add Variable and enter a variable name. A variable name can contain 1 to 50 characters, including letters, digits, hyphens (-), underscores (_), and periods (.). Select a variable type, enter a variable value, select the read and sharing modes, and click Save in the Operation column to add the variable. In this practice, add an integer global variable named number.
      Figure 1 Adding a global variable of the integer type
    • Adding a global variable of the file type
      1. In the Global Variable dialog box, click Download the .csv Template or Download the .xlsx Template as required.
      2. Enter the variable names and values by referring to the template. As shown in Figure 2, enter variable names in the first row and enter variable values from the second row. The rules for filling in the .csv and .xlsx files are the same.
        Figure 2 Example of filling file variables

        The file variables are described as follows:

        1. Variable name: Enter 1 to 50 characters, including letters, digits, hyphens (-), underscores (_), and periods (.).
        2. Only .csv (UTF-8 without BOM) and .xlsx files can be imported.
        3. A file name (including the extension) can contain a maximum of 50 bytes. Letters, digits, and underscores (_) are allowed.
        4. Maximum file size:
          • .xlsx: 10 MB for the Professional edition and 20 MB for the Enterprise edition.
          • .csv: 10 MB for the Professional edition and 80 MB for the Enterprise edition by default.
      3. Click Import File Variable to upload the configured variable file.

  6. After global variables are added, close the Global Variable dialog box.
  7. Insert the added global variable into the test case. For example, insert the created global variable number to the sample case request information in 3.

    1. Enter $ in the request information input box.
    2. In the Insert Variable dialog box, set Type to Custom and Range to Global, and enter number as the variable name.
    3. Click Select to insert a variable.
      Figure 3 Insert the variable named number