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

Obtaining String Length

Function Name

$strLen(String A)

Parameter Description

  • String A: original string whose length is requested.

Parameter A supports the following types:

  • Strings
  • Local parameters

Function Description

Obtains the length of a specified string.

Application Scenarios

The string length function can be used in the following scenarios for API automation cases:

  • 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 test in the request URL is the string length function that uses the local parameter ${test}.

  • Request header

As shown in the following figure, the value of test in the request header is the string length function whose parameter A is the local parameter ${test}.

  • Request body

    As shown in the following figure, the request body uses the string length function whose parameter A is the local parameter ${test}.

  • Checkpoint property

    As shown in the following figure, the target value of the checkpoint property result is the string length function whose parameter A is the environment parameter $${info}.

  • if condition

    As shown in the following figure, the target value of the if condition is the string length function uses the local parameter ${test}.

  • for loop interrupt condition

    As shown in the following figure, the target value of the for loop interrupt condition is the string length function uses the local parameter ${test}.