Skip to main content
Version: 1.0.1

Using API in Test Scenario, Test Suite

Configuring a new API test is just the first step of creating the API on the system. The usage of the API in the test scenario or test suite will be completely configured by the user.

How to Use API in Test Scenario​

Step 1: Access the Low-code screen for testing scenarios. Refer to Low-code Test scenario.

Step 2: Use the Key-word Controller "Client" and set the Platform as "Api".

alt text

Step 3: Drag the API CALL keyword into the low-code screen within the client API.

alt text

Step 4: Configure the Api Call Property and select the code data on the Api call property screen.

alt text

Step 5: The screen will display the list of APIs that have been created. Click to select the API you want to call.

alt text

Step 6: After selecting the API, the Api call property screen for the API call keyword will change.

alt text

Field NameMandatoryFormatConstraintsDescription
CodeYesAutoCompleteThe code of the selected API in the API Explorer
EnpointsYesComboboxDisplays the list of endpoints that have been created for the selected API. You must choose one value.
Request TypeYesComboboxDisplays the request type options: + None: No request body, + Multipart-form: Form request with a file, + Application json: Sends JSON data in the request body, + Application xml: Sends XML data in the request body, + Raw: Sends data in any custom format like JSON, XML, or any other text format. You can select one value.

Input: Parameters used for the API

Field NameMandatoryFormatConstraintsDescription
ServerYesTextDefault parameter of the API, should appear when using the API Call.The endpoint address for calling the API. The server will combine with the endpoint's path to form the URL for calling the API.
Các Parameter Input-Displays if parameters are declared in the selected endpoint or if parameters are defined in the test configuration.Enter data used as input for the API parameters. Select the data source and values appropriate for the selected parameter's value source.

Output: Parameters for the API response

Field NameMandatoryFormatConstraintsDescription
TypeYesComboboxDisplays the list of data types for the output variable. You can select one value.
Data TypeYesComboboxDefault to Call OutputThe data type of the output variable to store the returned output from the endpoint.
NameYesTextThe name of the variable that will store the output value.

Bước 7: Click Close button to save the Api call property. The low-code line will look as follows:

alt text

Note: The output variable here will contain the entire response list returned by the API. Therefore, to retrieve parameters from the returned response, you need to configure how to extract parameters from the response.

Step 8: Use the Assign Value keyword to create a variable to store the response value.

The response parameters will depend on the status code and content type of the response.

For example:

  • If the Response Status Code = 200, Content Type = Application json: response parameter = result_200_json
  • If the Response Status Code = 500, Content Type = Any: response parameter = result_500
  • If the Response Status Code = Any, Content Type = Application xml: response parameter = result_xml

alt text

Configure the variable to store the value:

alt text

Configure the value extracted from the response. The output returned by the API is placed in the "result_200_json" field, with the data type being JSON.

alt text

alt text

Retrieve the value of "id" from the response

alt text

Step 9: Click Save on the Low-code section. When executing the scenario, the returned data will match the output parameters that have been created.

alt text