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

Binary Addition Function

Function Name

$add(intA, intB)

Function Description

Implements the addition operation between parameter A and parameter B. Parameters A and B support the following types:

  • Numbers
  • Local parameters
  • Binary operations

Application Scenarios

The binary addition function can be used in the following scenarios for API automation:

  • Request URL
  • Request header
  • Request body
  • Checkpoint property
  • if condition
  • for loop interrupt condition

Example

  • Request URL

    As shown in the following figure, the value of the test parameter in the request URL is the binary addition function. Parameters A and B in the function are 1000.

  • Request header

    As shown in the following figure, the value of parameter add in the request header is the binary addition function. Parameter A in the function is the binary subtraction function $subtract (1001,1000), and parameter B is -1.

  • Checkpoint property

    As shown in the following figure, the target value of the checkpoint property result is the binary addition function. Parameter A in the function is the local parameter test, and parameter B is 1. For details about how to set local parameters, see Local Parameters.

  • if condition

    As shown in the following figure, the target value of the if condition is the binary addition function. Parameter A in the function is 1, and parameter B is the environment variable status. For details about how to set environment parameters, see Setting Environment Parameters of an API Script.

  • for loop interrupt condition

    As shown in the following figure, the target value of the for loop interrupt condition is the binary addition function. Parameters A and B in the function are 1000.