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

Managing JMeter Test Plans

Creating a Test Plan

A test plan is used to initiate a performance test based on the defined JMeter files, JAR packages, and variable files.

  1. Log in to the CodeArts PerfTest console. In the navigation pane on the left, choose JMeter Projects. Then click in the row containing the desired project.
  2. On the Test Plans tab, click Create Task Plan.
  3. In the dialog box that is displayed, click Select File, select a .jmx file, and click Upload. When the file is imported, the dialog box closes automatically and the Test Plans tab is displayed. You can view the added test plan.

    • The name (including the extension) of a JMX file can contain up to 64 bytes. The file size can be up to 10 MB.
    • Basic JMeter scripts are supported, including thread group, HTTP request, HTTP Header Manager, request parameters, BeanShell, and timeout interval. You are advised to use a script of version 5.2.1 or later. Otherwise, a script parsing error may occur.

  4. On the Test Plans tab page, click Third Party Jar. In the displayed dialog box, click Select File, select and import the JAR package on which the test plan depends. After the package is imported, close the dialog box.

    The name (including the extension) of a JAR package can contain up to 64 bytes. The package size can be up to 80 MB.

  5. View the newly added test plan on the Test Plans tab.

Pressure Configuration

After creating a test plan, you can edit phase parameters.

  1. Log in to the CodeArts PerfTest console and choose JMeter Projects in the left navigation pane. Click in the row containing the test project to which the desired test plan belongs.
  2. On the Test Plans tab page, click the name of the desired test plan. On the Plan Detail page, you can view the stages of different thread groups. Set the basic information by referring to Table 1.

    Table 1 Pressure configuration

    Parameter

    Description

    Execution Policy

    The value can be Duration or Count.
    • Duration: Tests will be performed based on the specified duration.
    • Count: Tests will be performed based on the total number of tests.

    Number of Threads

    Number of concurrent virtual users.

    Ramp-up Period

    It corresponds to the ramp-up period in JMeter scripts. The parameter indicates the time required for increasing the number of concurrent users from 0 to the specified value.

    NOTE:

    This parameter is involved only in Phase1.

    Loop Count

    Number of execution times of each virtual user.

    NOTE:

    This parameter needs to be configured only when Execution Policy is set to Count.

    Specify Thread Lifetime

    If you enable this option, you can configure the Duration and Startup Delay parameters.

    NOTE:

    This parameter needs to be configured only when Execution Policy is set to Count.

    Duration

    If the actual test duration reaches the maximum duration and the number of execution times does not reach the number of cycles, the thread group execution ends.

    NOTE:

    This parameter can be configured only when Execution Policy is set to Count and Specify Thread Lifetime is enabled.

    Duration

    How long the test will run. It is recommended that the duration be set to at least 300 seconds.

    NOTE:

    This parameter needs to be configured only when Execution Policy is set to Duration.

    Startup Delay

    When a test task is started, CodeArts PerfTest will wait the duration of startup delay before generating virtual users.

    NOTE:

    This parameter can be configured when Execution Policy is set to Count and Specify Thread Lifetime is enabled.

    When Execution Policy is set to Duration, you can modify this parameter for Phase1.

  3. Click OK.

Debugging a Test Plan

When a test plan is added or modified, you can debug it to quickly detect syntax or configuration errors and ensure that the model is available in a performance test.

  1. Log in to the CodeArts PerfTest console and choose JMeter Projects in the left navigation pane. Click in the row containing the test project to which the desired test plan belongs.
  2. On the Test Plans tab page, click the name of the task to be debugged. On the plan details page that is displayed, click in the upper part of the page.
  3. On the debugging page, select a created private resource group as the executor and click Start to start debugging. You can view the debugging progress on the debugging page.
  4. After the debugging is complete, if an error is reported, modify the case based on the exception information and debug the case again. For details on how to import a .jmx file, see the section on modifying a test plan in Managing Test Plans.
  5. Click View log to view the test plan debugging details.
  6. On the Debug log tab page, you can view the debugging history.

Associating an Analysis Object (Optional)

Prerequisites

The test plan is not enabled.

Procedure

  1. Log in to the CodeArts PerfTest console. In the navigation pane on the left, choose JMeter Projects. Then click in the row containing the desired project.
  2. On the Test Plans tab page, select the test task to be associated with the analysis object, and click .
  3. Select the analysis object to be associated. If you need to associate another analysis object, click Add Object to add one by referring to Configuring Intelligent Analysis for JMeter Projects. Then select the added analysis object to associate it, and click OK.

Starting a Test Plan

Test plans are a series of tests performed at different pressure points to continuously initiate pressure tests on a system. Testing allows you to obtain and analyze the performance data of the system.

You can add multiple test plans to a test project.

Prerequisites

  • The resource group is in the Running state.
  • Ports 32001 and 32003 on the debugging node of the resource group are enabled in the security group.
  • The execution node of the resource group and applications under the pressure test are connected through the network.

Procedure

  1. Log in to the CodeArts PerfTest console. In the navigation pane on the left, choose JMeter Projects. Then click in the row containing the desired project.
  2. Create a test plan. For details, see Creating a Test Plan.
  3. Click in the row containing the created task.
  4. In the Start Test Task dialog box, select a resource group. Only private resource groups are supported for executing JMeter tasks.
  5. Click Start to start the test task. Click View Report to view the real-time performance report.

    It is recommended that the duration of a pressure test be at least 300s and the number of concurrent users be set based on the actual situation. Obtain the maximum pressure value for the application through repeated tests by adjusting test data, and perform continuous optimization and verification for the application.

Managing Test Plans

You can manage created test plans.

Enabling test plans in batches

Enable multiple test plans in a test project.

  1. Log in to the CodeArts PerfTest console. In the navigation pane on the left, choose JMeter Projects. Then click in the row containing the desired project.
  2. On the Test Plans tab page, select multiple test plans and click Start.
  3. Select resource groups of these tasks and click Enable.

Advanced configuration of test plans

  1. Log in to the CodeArts PerfTest console. In the navigation pane on the left, choose JMeter Projects. Then click in the row containing the desired project.
  2. On the Test Plans tab page, click in the row containing the desired plan.
  3. Configure advanced parameters.

    1. Executor: The number of executors takes effect only when private resource groups are used. If this parameter is not set, the default policy is used, that is, a single executor supports concurrent JMeter (1000). Number of executors ≥ Maximum number of concurrent users in all phases/1,000.
    2. Failure Log Collection Ratio: By default, the sampling ratio is 10‰, and can be set to 1000‰ at most.

  4. When the configuration is complete, click OK.

Editing a test plan

  1. Log in to the CodeArts PerfTest console. In the navigation pane on the left, choose JMeter Projects. Then click in the row containing the desired project.
  2. On the Test Plans tab page, click in the Operation column of the desired plan, and choose Update jmx.
  3. In the displayed Edit Test Plan dialog box, import a new .jmx file, and then click Close.
  4. On the Test Plans tab page, click in the Operation column of the desired plan, and choose Variable File to import the files to be referenced by the test plan.

    1. Only .csv (UTF-8 without BOM) and .xlsx files can be imported.
    2. The maximum length of a file name (including the extension) is 50 bytes.
    3. Maximum file size:
      • .xlsx: 10 MB for the Professional edition and 20 MB for the Enterprise edition.
      • .csv: 10 MB for the Professional edition and 80 MB for the Enterprise edition by default.

Deleting a test plan

Deleted test plans cannot be recovered. Exercise caution when deleting a test plan.

  1. Log in to the CodeArts PerfTest console. In the navigation pane on the left, choose JMeter Projects. Then click in the row containing the desired project.
  2. On the Test Plans tab page, click in the Operation column of the desired plan, and choose Delete. You can also select multiple test plans and click Delete to delete them all.

    Figure 1 Deleting one or more test plans

  3. Delete the test plans as prompted.

Deleting phases

  1. Log in to the CodeArts PerfTest console. In the navigation pane on the left, choose JMeter Projects. Then click in the row containing the desired project.
  2. On the Test Plans tab page, click the task name to go to the Plan Detail page.
  3. Select the desired thread group, click next to the phase to be deleted, and click OK.

    Phase1 cannot be deleted.

Exporting JMX Files, Variable Files, and JAR Packages

Prerequisites: The JMX files, variable files, and JAR packages have been imported.

  1. Log in to the CodeArts PerfTest console. In the navigation pane on the left, choose JMeter Projects. Then click in the row containing the desired project.
  2. On the Test Plans tab page, click in the Operation column of the desired plan, and choose Export to export its .jmx file.
  3. Click in the row containing the test plan whose variable file is to be exported and choose Variable File. The Variable File dialog box is displayed.
  4. Click Export in the row containing the variable file to be exported.
  5. Click Third Party Jar. The Third Party JAR Package dialog box is displayed.
  6. Click Export in the row containing the desired JAR package to export it.