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.
- Log in to the CPTS console. In the navigation pane on the left, choose JMeter Test Projects. Locate the target test project and click Edit Test Plan.
- On the Test Plans tab, click Add Task Plan.
- In the dialog box that is displayed, click Select File, select a .jmx file, and click Import. When the file is imported, the dialog box closes automatically and the Test Plans tab is displayed. You can view the added test plan.Note
- The maximum size of the .jmx file is 10 MB.
- Basic JMeter scripts are supported, including thread group, HTTP request, HTTP Header Manager, request parameters, BeanShell, and timeout interval. Some third-party plug-ins are not supported. You are advised to use a script of version 5.2.1 or later. Otherwise, a script parsing error may occur.
- On the Test Plans tab, click Third Party Jar. In the displayed dialog box, click Import File, select and import the JAR package on which the test plan depends. After the package is imported, the dialog box closes and the Test Plans tab is displayed.Note
The maximum size of a JAR package is 10 MB.
- View the newly added test plan on the Test Plans tab.
Adding a Phase
When a test plan is created, a phase stage1 is added by default. You can add multiple phases. When Execution Policy is set to Count for a thread group, only one phase is allowed.
- Log in to the CPTS console and choose JMeter Test Projects in the navigation pane on the left. Locate the target test project and click Edit Test Plan.
- On the Test Plans tab, click
next to the target test plan to expand it.
- Click
next to the target thread group to expand the group, and click Add Phase.
- Set the parameters listed in Table 1.
Table 1 Adding a phase Parameter
Description
Execution Policy
Retain the default value Duration.
Concurrent Users
Number of concurrent virtual users.
Duration
How long the phase will run. It is recommended that the duration be at least 300 seconds.
- Click OK.
When the phase is added, a load prediction chart for the phase is generated.
Editing a Thread Group
After creating a test plan, you can edit phase parameters.
- Log in to the CPTS console and choose JMeter Test Projects in the navigation pane on the left. Locate the target test project and click Edit Test Plan.
- On the Test Plans tab, click
next to the target test plan to expand the plan.
- Click
next to a thread group and you can view the phases in the group.
- Click
next to the phase to be edited and set the phase parameters by referring to Table 2.
Table 2 Editing a thread group Parameter
Description
Execution Policy
The value can be Duration or Count.
- Duration: The test will be performed based on the specified duration.
- Count: The test will be performed based on the total number of transmissions.
Concurrent Users
Number of concurrent virtual users.
Warm-up Time
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 stage1.
Cycles
Number of execution times of each virtual user.
NOTE:This parameter needs to be configured only when Execution Policy is set to Duration.
Time Control
If you enable the time control, you can configure the Maximum Duration and Startup Delay parameters.
NOTE:This parameter needs to be configured only when Execution Policy is set to Count.
Maximum 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 needs to be configured only when Execution Policy is set to Count and Time Control is enabled.
Test Duration
How long the test will run. It is recommended that the duration be at least 300 seconds.
Startup Delay
When a test task is started, CPTS will wait the duration of startup delay before generating virtual users.
NOTE:When Execution Policy is set to Count, you can modify this parameter only when Time Control is enabled.
When Execution Policy is set to Duration, you can modify this parameter for stage1.
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.
- Log in to the CPTS console. In the navigation pane on the left, choose JMeter Test Projects in the navigation pane on the left. Click Edit Test Plan next to the project for which the test plan will be debugged to edit the test plan.
- On the Test Plans tab, click
next to the test plan to be debugged.
- In the displayed dialog box, click Start Debugging, select a resource group, and click Debug.
- CCE resource group: a CCE resource group created in your account.
- Private CCE resource group: a private CCE resource group created in your account.
NoteA JMeter test and CPTS test cannot share a CCE resource group. You are advised to create a CCE resource group for a JMeter test.
- On the Debug Log tab, view the debugging logs.
- After the debugging is complete, view the debugging details of the test plan on the Result tab page.
If an error is reported in the result, modify the .jmx file based on the error logs and import the file again. For details on how to import a .jmx file, see the section on modifying a test plan in Managing Test Plans.
Associating an Analysis Object (Optional)
Prerequisites
The test plan is not enabled.
Procedure
- Log in to the CPTS console. In the navigation pane on the left, choose JMeter Test Projects. Locate the target test project and click Edit Test Plan.
- On the Test Plans tab page, select a test plan and click Associate Analysis Object.
- If you need to associate another analysis object, click Add Object. For details, see Configuring Intelligent Analysis for JMeter Test Projects. Select the analysis object to be associated, and click OK.
Enabling a Pressure 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 management 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
- Log in to the CPTS console. In the navigation pane on the left, choose JMeter Test Projects. Locate the target test project and click Edit Test Plan.
- Create a test plan. For details, see Creating a Test Plan.
- When the test plan is created, click
next to the task.
- In the Enable Test Task dialog box, select one resource group type from the Resource Group Type drop-down list.
- CCE resource group: a CCE resource group created in your account.
- Private CCE resource group: a private CCE resource group created in your account.
- Click Enable to enable the test task.Note
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.
- (Optional) Click View Report to view the real-time test report.
Managing Test Plans
You can manage created test plans.
Enabling test plans in batches
Enable multiple test plans in a test project.
- Log in to the CPTS console. In the navigation pane on the left, choose JMeter Test Projects. Locate the target test project and click Edit Test Plan.
- On the Test Plans tab page, select multiple test plans and click Start.
- Select resource groups of these tasks and click Enable.
Modifying a test plan
- Log in to the CPTS console. In the navigation pane on the left, choose JMeter Test Projects. Locate the target test project and click Edit Test Plan.
- On the Test Plans tab, click More > Update JMX next to the test plan to be modified.
- In the displayed Edit Test Plan dialog box, import a new .jmx file, and then click Close.
- Click Variable File next to the test plan name and import the variable file to be referenced by the test plan.
Deleting a test plan
Deleted test plans cannot be recovered. Exercise caution when deleting a test plan.
- Log in to the CPTS console. In the navigation pane on the left, choose JMeter Test Projects. Locate the target test project and click Edit Test Plan.
- On the Test Plans tab page, click More > Delete next to the test plan to be deleted. You can also select multiple test plans and click Delete to delete them all.
- Delete the test plans as prompted.
Deleting a phase
- Log in to the CPTS console. In the navigation pane on the left, choose JMeter Test Projects. Locate the target test project and click Edit Test Plan.
- On the Test Plans tab, click
next to the target test plan to expand it.
- Locate the target thread group and click
to expand it.
- Click
next to the target phase and click OK.
Notestage1 cannot be deleted.
Exporting .jmx files, JAR packages, and variable files
- Log in to the CPTS console. In the navigation pane on the left, choose JMeter Test Projects. Locate the target test project and click Edit Test Plan.
- On the Test Plans tab page, click More > Export next to the test plan whose .jmx file is to be exported.
The .jmx file is exported.
- Click Variable File next to the test plan whose variable file is to be exported. The Variable File dialog box is displayed.
- Select the variable file to be exported, and click Export.
The variable file is exported.
- Click Third Party Jar. The Third Party JAR Package dialog box is displayed.
- Click Export next to the JAR package to be exported.
The JAR package is exported.
- Creating a Test Plan
- Adding a Phase
- Editing a Thread Group
- Debugging a Test Plan
- Associating an Analysis Object (Optional)
- Enabling a Pressure Test Plan
- Managing Test Plans