As soon as you launch JMeter, you will see the Test Plan element.
- Test Plan is where you add elements required for your JMeter Test.
- It stores all the elements (like ThreadGroup, Timers, etc) and their corresponding settings required to run your desired Tests.
The following figure shows an example of the Test Plan
How to add Elements?
- Adding Elements is the essential step to build a Test Plan because without adding elements, JMeter cannot execute your Test Plan.
- A Test Plan includes many Elements such as Listener, Controller, and Timer
- You can add an element to test plan by right-clicking on a Test Plan and choose new elements from the Add list.
- Suppose, you want to add 2 elements to Test Plan BeanShell Assertion and Java Request Default.
- Right click Test Plan -> Add -> Assertion-> Bean Shell Assertion.
- Right-click Test Plan -> Add -> Config Element -> Java Request Default.
- You can also remove an unused element.
- Let's say, you want to remove element HTTP Request Defaults, select HTTP Request Default -> Right click-> choose Remove from the context menu -> Click Yes to confirm delete this element on the message box.
Loading and Saving Elements:
How to Create a JMX file
- Suppose you have already added an element name BeanShell Assertion.
- Now you want to save it.
- Right-click BeanShell Assertion -> select Save Selection As.
- A dialog box display, click the Save button to save your elements under default name BeanShell Assertion.jmx. You can choose other names if you want.
- JMeter Test Elements and Test plans are stored in *.JMX format. JMX is standing for Java Management Extensions.
How to Run JMX file:
- Loading exist elements helps you save your time required to create & configure new elements.
- Let's say that you have an existing element in Test Plan: Java Request Default.
- Right-click Java Request Defaults-> select Merge.
- Next, Choose the Elements (BeanShell Assertion.jmx.) file in the directory. This element will be added to your current test plan.
How to Configure Elements:
- In order to configure any Element
- Select the element in the Tree on Left Pane
- Enter configuration settings on the Right Pane
How to Save a Test Plan:
Before running a test, you should save your Test Plan first. Saving your Test Plan helps you avoid an unexpected error when running the test plan.
Steps to saving Test plan
- File -> Save Test Plan as-> a Dialog box display
- Enter a filename of Test Plan ->click Save
Difference Between Saving a Test Plan and Saving an Element :
|Saving a Test Plan
||Saving an Element
|Test Plan consists of one or many elements
||Element is a basic component of JMeter
|When you save your Test Plan, all those elements in the plan are saved
||When you save your elements, only one element is saved.
Create a Combo Test Plan:
- You can merge one or many Test Plans to create a combo Test Plan as shown in below figure
- Suppose you already have an existing Test Plan name Test_Fragment.jmx on your computer, You can merge this test plan to the current Test Plan on JMeter to create a new Test Plan.
- Now all the test elements in file Test_Fragment.jmx are added to your current test plan as shown in.
How to Run Test Plan:
- To run your single or multiple test plans, choose Start (Ctrl+R) from the Run menu item.
- When JMeter is running, it shows a small green box at the right-hand end of the menu bar.
- The numbers to the left of the green box are the number of active threads / total number of threads.
- To Stop the Test, press
Stop button or use short key
Ctrl + '.'
When test execution is done, you can get the test report. The test report includes the error log file, which is saved in jmeter.log, and the test results summary. Here is a sample log file of JMeter.