JMeter Test Plan Management
- Processes, standards and quality
I would like to present to you how to organize your work better while using JMeter. Sometimes a test plan treegrows quite large, which makes the plan less legible and more difficult to maintain.
In such a case, the following JMeter modules can be useful:
- Test Fragment
- Module Controller
- Include Controller
Ad 1. Test Fragment – this module can only be added directly below a Test Plan element (note though it cannot be added as a part of the subtree Thread Group). Within the module, you can define particular steps of the performance test, e.g. HTTP Sampler. Test Fragment element cannot simulate test execution for its own, it have to be earlier referenced by Module Controller element.
Ad 2. Module Controller – the element which allows redirecting test execution to a given fragment of the test.
Ad 3. Include Controller – enables adding tests plans to already existing ones. Configuration of an element consists in adding path to the *jmx file along with a tests plan.
Abbreviations stand for the following modules:
- [MC] – Module Controller
- [TF] – Test Fragment
- [IC] – Include Controller
Example of Module Controller and Test Fragment use:
The tests plan depicted above is composed of 2 thread groups, namely, Test 1 and Test 2 (the red area in the picture). Inside them, there are consecutive tests steps composed of the Module Controller elements, that is, links to tests fragments, placed in the blue area in the picture. The green area is [MC] the Action 3 element, with a drop-down list of all available test fragments [TF].
The sets of user operations for different test cases repeat very often. It is more convenient then to record script, add parameters and use it for particular operations (here: Login, Logout, Action3).
Example of Include Controller use:
The picture above shows the same tests, however this time the Include Controller elements have been used. As an argument, the module takes the path to a file containing a test plan defining following operations(see picture below – this is a regular tests plan with one Test Fragment ). A plan should not contain any added configuration elements such as HTTP Request Defaults, User Defined Variables, HTTP Cookie Manager , which should be defined once in the main tests plan.
Advantages of discussed modules:
- Ability to create test cases libraries
- Reusability – repetitive test elements can be treated as a one Test Fragment, used repeatedly
- Better control over tests plan structure
Disadvantages of discussed modules:
- Using test plans from external files can hamper quick adjustments.