Updated on 2024-04-08 GMT+08:00

Creating a Test Case

Procedure

  1. Log in to the CodeArts PerfTest console and choose PerfTest Projects in the navigation pane.
  2. Locate the row that contains the target PerfTest project, and click the test project name, for example, Web-test. The test project details page is displayed. On the Cases tab, you can view the default directory and sample cases that are automatically generated.
  3. In the default directory, choose Sample Case. Click Case Script and select Pre-Steps or Steps.

    Pre-Steps are executed only once in each execution thread. This configuration is optional.

    Steps are executor of a test case, which needs to be configured.

  4. In the case, click Add Request. Enter a request name and add requests.

    • Packet

      (Mandatory) Packets are data blocks sent between HTTP applications.

      Click the Packet tab, and set packet parameters based on the actual service to be tested.

    • Think time

      (Optional) To better simulate user behavior, it is necessary to simulate the waiting time between different operations. For example, when you receive data from a server, you may wait for several seconds to view the data before responding. This latency is called Think Time.

      Set Think Time based on requirements. For more effective testing, do not set a long think time. You are advised to test the server for the worst case scenario.

      Enable Think Time and set Duration to 1000 ms.

    • Response extraction

      (Optional) If multiple packets exist in the same case, use regular expressions or JSON to extract the output of the previous packet for the input of the next packet.

      Enable Response Extraction and set parameters.

    • Checkpoint

      (Optional) When enabled, you can check whether the content returned by a server is correct through customized verification information.

      Enable Checkpoint and set parameters.

  5. Select Pressure Stage.

    You can select different pressure modes and add multiple phases. Each phase can simulate different numbers of concurrent users.

  6. Click Save.
  7. Click Debug in the upper right corner of the page. Select the target test resource group as the executor and click Start.
  8. Click View log to view the test case debugging details.

    If an error was reported in the debugging result, edit the case based on the log information and debug it again.

  9. On the Debug log tab page, you can view the debugging history.