How to build a test plan and how to execute the test plan on jmeter

Tram Ho

A script of a series of Jmeter steps will be executed at runtime. A test script will consist of one or more Thread Groups, control logic, prototyping controllers, listeners, timers, validation, and configuration components.

1.1. Add and delete elements

Add elements to the test plan by right-clicking on tree elements and selecting a new element from the add list. Alternatively, elements can be downloaded from the file and added by selecting the “merge” or “open” option. To delete an element, make sure the element is selected, right-click on the element and select the “delete” option. To delete an element, make sure the element is selected, right-click on the element and select the “delete” option.

1.2. Load and save elements

To load an element from the file, right-click on the existing tree element to which you want to add the loaded element and select the “merge” option. Select the file in which your elements are saved. JMeter will merge the elements into the tree. To save the tree elements, right-click an element and select the “Save selection as” option. JMeter will save the selected element, plus all children below it. In this way, you can save individual test tree segments and elements for later use.

1.3. Configuration of tree elements

Any element in the test tree will show the controls in the right pane of JMeter. These controls allow you to configure the behavior of that particular test element. What can be configured for an element depends on the element type.

The test tree itself can be manipulated by dragging and dropping components around the test tree.

1.4. Save the test plan

Although not required, we recommend saving the Test Plan to a file before running. To save a Test Plan, select “Save” or “Save test plan as” from the File menu (with the latest release, there is no longer need to first select the Test Plan element).

JMeter allows you to save the entire Test Plan tree or only part of it. To save only elements within a specific “branch” of the Test Plan tree, select the Test Plan element in the tree to start the “branch”, then click your right mouse button to access go to “Save selections as” Menu item. Or, select the appropriate Inspection Plan element and then select “Save selection as” from the Edit menu.

1.5. Run a test plan

To run your test package, select “Start” (Control + r) from the “Run” menu item. When JMeter is running, it displays a small green box on the right hand side of the section just below the menu bar. You can also check the “Run” menu. If “Start” is disabled and “Stop” is enabled, JMeter is running your test plan (or, at least, it thinks so).

The numbers to the left of the green box are the number of active topics / total threads. These apply only to a locally run test; they do not include any threads that are started on remote systems when using client-server mode.

Using the GUI mode as described here should only be used when debugging your Test Plan. To test load, use CLI mode.

1.6. Stop the test

There are two types of stop orders available in the menu:

Stop (Control +.) – Stop the stream immediately if possible. Many interrupted sampler means that the active sample may be terminated early. The stop command will check that all threads have stopped during the default timeout, which is 5000 ms = 5 seconds. If the thread has not stopped, a notification will be displayed. The Stop command may be retried, but if it fails, it is necessary to exit JMeter to clean it up.

Shutdown (Control +,) – requires the threads to stop at the end of any current job. Will not interrupt any active template. The mode shutdown dialog will remain active until all streams have stopped

If the shutdown takes too long. Close the Shut down Dialog box and select Run / Stop or just press Control + ..

When running JMeter in CLI mode, there is no Menu and JMeter does not respond to keystrokes like Control + .. Therefore, JMeter CLI mode will listen for commands on a specific port (default 4445, depending on Calculate JMeter jmeterengine.nongui.port). JMeter supports automatically selecting an alternate port if the default port is being used (eg by another JMeter object). In this case, JMeter will try the next higher port, continue until the default JMeter property jmeterengine.nongui.maxport) is set to 4455. If maxport is less than or equal to port, port scanning will not take place. out.

The selected port is displayed in the console window.

The commands currently supported are:

Shutdown – graceful shutdown StopTestNow – shutdown immediately

These commands can be sent using the shutdown script [.cmd | .sh] or stoptest [.cmd | .sh]. The script will be found in the JMeter bin directory. Commands will only be accepted if the script is run from the same server.

1.7. Error message

JMeter reports warnings and errors for the file jmeter.log, as well as some information about the autorun test. JMeter displays the number of warnings / errors found in the jmeter.log file next to the warning icon (triangle) on the right hand side of the window. Click the alert icon to display the jmeter.log file at the bottom of the JMeter window. Only occasionally there may be some errors that JMeter cannot trap and log in; These will appear on the command panel. If a check does not work as you expect, please check the log file in case of any reported errors (for example, there may be a syntax error in the function call).

Sampling errors (for example, HTTP 404 – file not found) are usually not reported in the log file. Instead, they are stored as attributes of the sample result. The status of a sample result can be seen in different Listener.

(Source: )

Share the news now

Source : Viblo