Updated on 2024-01-18 GMT+08:00

Importing an API Automation Case

Background

CodeArts TestPlan allows you to generate test cases by importing files in any of the following formats:

  • Postman: Postman Collection v2.1 standard, Postman Collection JSON file
  • Swagger: Swagger 2.0 and 3.0 standards, YAML file
  • Excel: Excel file based on the given template

Importing a Postman or Swagger File

Only one test case can be imported at a time. In addition, only test steps can be generated for the imported test case. Preparations and followups are not supported.

  1. Log in to the CodeArts homepage, search for your target project, and click the project name to access the project.
  2. In the navigation pane, choose Testing > Testing Case.
  3. Click the Auto API Test tab and choose Import > Import from File on the right of the page. The Import Case from File window is displayed.
  4. Select Postman or Swagger.

    Drag a file from the local PC to the window, or click Click or drag to add a file and select a file from the local PC. Click Next.

  5. In the displayed list, select the items for which you want to generate test cases based on the step sequence and click save.

Importing an Excel File

A maximum of 500 test cases can be imported at a time using an Excel file.

  1. Log in to the CodeArts homepage, search for your target project, and click the project name to access the project.
  2. In the navigation pane, choose Testing > Testing Case.
  3. Click the Auto API Test tab and choose Import > Import from File on the right of the page.
  4. Select Excel and click Download Template.

  5. Open the Excel template on the local PC and edit the test case information based on the comments in the template headers. The columns marked with asterisks (*) are required.

    The fields in the template are as follows.

    Field

    Mandatory

    Description

    Case Name

    Yes

    The value can contain only 3 to 128 characters and allows uppercase letters, lowercase letters, digits, and special characters (-_/|*&`'^~;:(){}=+,×...—!@#$%.[]<>?–").

    Case Description

    No

    The value contains no more than 500 characters.

    Request Type

    Yes

    Only GET, POST, PUT, and DELETE are supported.

    Request Header Parameter

    No

    The format is key=value.

    If there are multiple parameters, separate them with &, that is, key=value&key1=value1.

    Request Address

    Yes

    The request protocol can be HTTP or HTTPS. The format is https://ip:port/pathParam?query=1.

    Environment Group

    No

    Environment parameter group.

    IP Variable Name

    No

    Generates the variable name in the corresponding Environment Group, extracts the content of the Request Address, and generates the corresponding global variable.

    Request Body Type

    No

    The value can be raw, json, or formdata, which corresponds to the text, JSON request body, or form parameter format on the page, respectively.

    If this parameter is empty, the JSON format is used by default.

    Request Body

    No

    If the request body type is formdata, the request body format is key=value. If there are multiple parameters, separate them with &, that is, key=value&key2=value2.

    When cases are imported using an Excel file, formdata does not support the request body in file format.

    Checkpoint Matching Mode

    No

    Supports Exact match and Fuzzy match. Exact match indicates Equals, and Fuzzy match indicates Contains.

    Expected Checkpoint Value

    No

    Target Value of the corresponding checkpoint.

  6. Save the edited Excel file and drag it from the local PC to the Import Case from File window, or click Click or drag to add a file and select a file from the local PC. Click Next.
  7. View the import result.

    • Import successful: New test cases are displayed in the list. The number of new test cases is the same as the number of rows in the Excel file.
    • Import failed: A failure message is displayed in the upper right corner.

      In the Import Case from File window, you can download the error list, modify the Excel file based on the error causes, and try again.