Test Plan is like a trial that you do before the actual execution. For a test plan to be really effective, it is done with actual data in a test environment. In the case of JMeter a test plan will have to involve elements like thread groups, samplers, listeners, assertions, timers and configuration elements. The test plan should have at least one or more of the above elements and it should definitely have at least one thread group.

How to write a test plan:

Step 1: Open JMeter

You can open the JMeter by clicking on /home/xxxx/apache-jmeter5.0/bin/jmeter.sh which will bring up the following open

There are two nodes in this window, Test Plan node and Workbench node. Actual test plan is kept in the Test Plan node and Workbench node acts as a temporary place where you can keep your test elements when they are not being used or while you do copy/paste. As it is a temporary place, when the actual test plan is saved, whatever you store in the Workbench node does not get saved as part of the test plan.

Step 2: Adding and Removing Elements

You can add new elements to the test plan as shown in the following window by doing a right click on the Test Plan node choosing whichever element you want to add from the list. Another way to do this is by clicking on ‘open’ or ‘merge’ and load the desired element from a file.

If you want to remove an element from the test plan, select the element and right click on it and select the option ‘remove’ as shown below

Step 3: To load the elements and Save

You can load an element from a file by right clicking on the element tree to which you wish to add a new element. Next click on merge and choose the file name where you have saved elements and JMeter will merge those elements to the chosen tree.

In order to save the element, you need to right click on the element and choose the option ‘Save Selection as’. You need to do save the element explicitly as JMeter doesn’t do it by default.

Step 4: To configure the tree element

There are controls in the side frame of Jmeter window on the right side to configure any element in the test plan. You can use these controls to configure the behaviour of any element in the test plan.

Following screen shows how ramp up periods is configured in a thread group.

Step 5: Save the Test plan

Choose ‘Save’ or ‘Save Test Plan As’ option from the File menu to save the test plan

Step6: Execute the Test Plan

Execute the test plan by clicking on ‘Run’ menu and then choosing ‘Start’. You can see a green small box under the menu bar at the right hand side while the test plan is running. It also shows a number on the left side which indicate the total number of threads/active threads.

Step7: To Stop the Test

There are two ways to stop the test, either use the option ‘Stop’ which immediately suspends the threads or use ‘Shutdown’ which stops the threads after at the end of its current task.