Help Center/ CodeArts PerfTest/ User Guide/ PerfTest Case Management/ Configuring a Test Case (High-Performance Test Projects)/ Adding a Data Instruction, Cycle Controller, Condition Judgment, or Rendezvous Point
Updated on 2024-06-06 GMT+08:00

Adding a Data Instruction, Cycle Controller, Condition Judgment, or Rendezvous Point

Data Instruction

  1. Log in to the CodeArts PerfTest console and choose PerfTest Projects in the left navigation pane.
  2. Click the name of the desired PerfTest project to go to the details page.
  3. On the Cases tab, select the desired test case in the case list on the left.
  4. On the Case Script tab, choose Add More > Data Set.
  5. Click Add Param, and configure Name, Logic, and Mode.

    • Name

      Name of the parameter to which the parameter logic result will be assigned as the parameter value.

    • Logic
      1. To assign a constant value to a parameter, enter a character string, for example, 1.23 or abc.
      2. To assign a variable value to a parameter, enter $ in the text box. In the displayed Insert Variable dialog box, select a variable type.

        If you set Type to Custom, set the following parameters:

        1. Range: variable range.
        2. Name: name of a custom variable. Specifies the name of a variable when the variable is added.
        If you set Type to System, select a function. For details, see Table 1.
        Table 1 Functions

        Name

        Description

        ID card number

        Randomly generates an ID number.

        Mobile phone number

        Randomly generates a phone number.

        Random number in a range

        Randomly generates an integer within your specified range.

        Random character string

        Randomly generates a string consisting of lowercase letters and numbers based on your specified string length (1 to 32 characters).

        Time stamp

        Generates a timestamp for the current time based on your specified unit. A 10-digit timestamp represents time in seconds whereas a 13-digit timestamp represents time in milliseconds.

        Datetime Format

        Outputs the current time in the specified format. Time offsets in seconds are supported.

        UUID

        Randomly generates a string of 32 characters.

        If you set Type to Four Fundamental rules, select a function.
        1. Select +, -, x, /, or Scale Mode from the drop-down list box, and click Select.
        2. Click . In the displayed Four Functions Editing dialog box, set the following parameters:
          • Expression: Enter operands for the arithmetic operation. An operand can be a number (such as 1.23), a global, local, or system variable. You can reselect the operation here.
          • Mode: Select how the expression result will be rounded. For details, see Table 2.
            Table 2 Rounding modes

            Name

            Description (Using Two Decimal Place Rounding as an Example)

            Far-zero Rounding

            Rounds the number in a way that the result heads away from zero. For example, 1.234 is rounded to 1.24, and –1.234 is rounded to –1.24.

            Near-zero Rounding

            Rounds the number in a way that the result heads towards zero. For example, 1.234 is rounded to 1.23, and –1.234 is rounded to –1.23.

            Round Up

            Rounds the number towards positive infinity. Positive numbers will be rounded up, whereas the unwanted digits of negative numbers will be simply discarded. For example, 1.234 is rounded to 1.24, and –1.234 is rounded to –1.23.

            Round Down

            Rounds the number towards negative infinity. The unwanted digits of positive numbers will be simply discarded whereas negative numbers will be rounded down. For example, 1.234 is rounded to 1.23, and –1.234 is rounded to –1.24.

            Rounding

            If the first digit to be discarded is smaller than 5, the digit and all the digits that follow are simply discarded. Otherwise, the last retained digit is increased by 1 in value. For example, 1.234 is rounded to 1.23 and –1.235 is rounded to –1.24.

            Rounded to six

            If the first digit to be discarded is smaller than 6, the digit and all the digits that follow are simply discarded. Otherwise, the last retained digit is increased by 1 in value. For example, 1.235 is rounded to 1.23 and –1.236 is rounded to –1.24.

            Bankers

            Rounds the number to its nearest even integer. For example. 1.2350000 is rounded to 1.24, 1.2250000 is rounded to 1.22, and 1.2250001 is rounded to 1.23.

            No Rounding

            The number is not rounded.

            NOTE:

            If this mode is selected, no further action is required.

          • Precision: The maximum number of decimal places is 32.
        3. When the configuration is complete, click OK.

        If you specify multiple logics for a parameter, all the logics are combined as a character string and the string is assigned to the parameter as its value.

        When the variable type is the encryption function, you need to select the encryption type and the position where the variable is inserted. The encryption types are as follows:
        • MD5: Encrypts the val data using MD5 and returns the encrypted data string.
        • MD5-BASE64: Performs MD5-BASE64 encoding on val data and returns the encoded data string.
        • SHA-1: Encrypts the input data using SHA-1 and returns the encrypted data string.
        • SHA-224: Encrypts the input data using SHA-224 and returns the encrypted data character string.
        • SHA-256: Encrypts the input data using SHA-256 and returns the encrypted data character string.
        • SHA-384: Encrypts the input data using SHA-384 and returns the encrypted data string.
        • SHA-512: Encrypts the input data using SHA-512 and returns the encrypted data character string.
        • BASE64 encoding: Encodes the input data using BASE64 and returns the encoded data string.
        • BASE64 decoding: Performs BASE64 decoding on the input data and returns the decoded data character string.
    • Mode
      • If you select Repeated assignment from the drop-down list box, a value is assigned each time the parameter value is needed in a thread.
      • If you select Assigned once from the drop-down list, the parameter value is assigned only once in a thread.

  6. When the configuration is complete, click Save.

Cycle Controller

  1. Log in to the CodeArts PerfTest console and choose PerfTest Projects in the left navigation pane.
  2. Click the name of the desired PerfTest project to go to the details page.
  3. On the Cases tab, select the desired case in the case list on the left.
  4. On the Case Script tab, choose Add More > Cycle Controller.
  5. Set parameters.

    Number of Cycles: Enter a value between 1 and 1,000,000.

    Exit Conditions: If the request meets the condition, the cycle ends. Both expressions and comparisons support variables and character strings. Currently, conditions cannot be combined. If you need to use a set or multiple comparisons, set a regular expression.

  6. Click Add More to specify more details for the cycle.

    A maximum of 10 layers of steps can be nested.

  7. When the configuration is complete, click Save.

Condition Judgment

  1. Log in to the CodeArts PerfTest console and choose PerfTest Projects in the left navigation pane.
  2. Click the name of the desired PerfTest project to go to the details page.
  3. On the Cases tab, select the desired case in the case list on the left.
  4. On the Case Script tab, choose Add More > Condition Controller.
  5. Set parameters.

    Judgment Condition: If a request meets the condition, the request, transaction, or other logic controller defined by the condition controller is executed. Both expressions and comparisons support variables and character strings. Currently, conditions cannot be combined. If you need to use a set or multiple comparisons, set a regular expression.

  6. Click Add More to add requests, transactions, or other logic controllers that are executed after conditions are met.

    A maximum of 10 layers of steps can be nested.

  7. When the configuration is complete, click Save.

Rendezvous Point

The purpose of a rendezvous point is to block concurrency until either X concurrent requests are blocked or the waiting time is reached, at which point all of them are released at a time. Therefore, a rendezvous point can create large instant loads at different points of the test case.

  1. Log in to the CodeArts PerfTest console and choose PerfTest Projects in the left navigation pane.
  2. Click the name of the desired PerfTest project to go to the details page.
  3. On the Cases tab, select the desired case in the case list on the left.
  4. On the Case Script tab, choose Add More > Rendezvous Point.
  5. Set parameters.

    Waiting Time (ms): waiting time at the rendezvous point.

    Concurrent Number: When the number of users reaches this quantity, the users waiting at the rendezvous are released.

  6. When the configuration is complete, click Save.