Updated on 2024-11-13 GMT+08:00

Importing an Automated API Test Case Dataset

API testing may involve testing a logic in multiple rounds with different data combinations. Manually configuring test case scripts for each round is labor- and time-consuming.

With CodeArts TestPlan, you can perform data-driven API testing by importing Excel files of test data to efficiently generate and execute automated API test cases for different test scenarios.

Currently, this feature is available in the AP-Singapore and LA-Mexico City regions.

Prerequisites

  1. You have configured an accessible request address in the script of the target API test case.
  2. You have set the fields in the Excel dataset file as local parameters.

Procedure

  1. In the navigation pane, choose Testing > Testing Case.
  2. Click the Auto API Test tab, click the target test case, and click the Scripting tab.
  3. Click .
  4. In the displayed dialog box, click the Default Environment drop-down box and select the target environment. For details about how to set the environment, see Setting Environment Parameters of an API Script.
  5. Click Download Template and save the Excel template file to the local PC.
  6. Fill in the dataset description and local parameters. If multiple rows of data are set, the test case will be executed using each row round by round.

    • Dataset Description: Optional. 1 to 128 bytes.
    • Other headers must have been set as local parameters (case-sensitive) in the case scripting page. For details, see Table 1.

  7. In the displayed dialog box, click , select the Excel file, and click Upload.

    1. A maximum of 100 rows and 50 parameter fields can be uploaded.
    2. Only one Excel file can be uploaded each time.
    3. Uploading a new Excel file will clear the data of the previous file, and the dialog box will show the data from the most recent upload.

  8. The uploaded data is displayed in the list. To delete the data, click Clear.
  9. Click Close.
  10. Click a URL request, and use $ to reference the configured local parameters. When the test case is executed, the values of the local parameters are read. For details about the execution, see Execution of an Automated API Test Case with a Dataset.