Updated on 2024-07-31 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, enumerated, or text type, or add file global variables with CSV or XLSX files.

    • Adding an integer, enumerated, or text global variable
      In the Global Variable dialog box, click Add Variable, enter a variable name, select a variable type, enter a variable value, select a read mode and sharing mode, and click in the Operation column. 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
        1. Use letters, digits, or underscores (_) for variable names. Variable values are not limited.
        2. Only UTF-8 without BOM files can be imported.
        3. A file name (including the extension) can contain a maximum of 50 bytes. Letters, digits, and underscores (_) are allowed.
      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.
      Figure 3 Inserting a variable
    3. Click Select to insert a variable.
      Figure 4 Insert the variable named number