Using a Load Generator in NetBeans IDE
When testing the performance of an application, it can be beneficial to perform your tests under a typical load. This can be difficult if you are running your application in a development environment. One way to emulate an application running under load is through the use of a load generator script. This document presents an overview of load generator support offered by the IDE.
Instead of supplying its own load generator runtime, the IDE relies on integrating third party tools. NetBeans IDE supports the Apache JMeter Load Testing Tool (homepage) to replay load testing scripts. To use the JMeter tool in the IDE, you first need to download the required plugins from the Update Center.
This document assumes you have some basic knowledge of, or programming experience with, the following technologies:
Software Needed for the Tutorial
For this tutorial you need to have the following software installed on your computer:
Installing the JMeter Plugins
You can easily add support for the JMeter load generator by downloading and installing the JMeter Kit and Load Generator plugins from the NetBeans Update Center.
To download the plugins, do the following:
After installing the plugins, the category Load Testing Scripts is added to the New File wizard.
Working with the JMeter Load Testing Script
Support for the JMeter plugins is closely integrated with the IDE's profiling tool. The JMeter plugins enable you to easily create and run JMeter load testing scripts from within the IDE.
To use a load generator script, you create a script for a specific project and modify the script according to the type of project load that would be placed on a server running the application. When you run the script, the script places a load on the server that emulates the behavior of the application under typical running conditions. You can then test the performance of the application and the test results you achieve would more closely approximate the performance of the application under typical conditions.
Creating a New Load Testing Script
After you download and install the plugins, a new category is created in the New File wizard. You use the New File wizard to create a load script file in your project.
To create a new load test script, do the following:
When you create a new script, the IDE places the script under the Load Generator Scripts node in the Projects window. In the Files window, you can see that the IDE saves the script in the jmeter directory. If you already have a load testing script created outside of the IDE, you can create a jmeter directory and add the script to the directory to run the script from within the IDE.
Editing a Load Testing Script
The JMeter external editor enables you to modify the script according to the needs of your application. After you have created a load testing script or added a script to your project, you can invoke the external editor by right-clicking the script in the Projects window and choosing External Edit.
For more information about editing the JMeter testing scripts, see the JMeter User Manual.
Starting a Load Testing Script
The load testing script can be started in the following ways:
Stopping and Restarting a Load Testing Script
You can stop and restart a load testing script from either the Output window or the Services window.
A JMeter tab opens in the Output window after the script has been loaded. The window displays the current state of the load generator. In the left margin of the Output window there are controls to start, stop or restart the script.
The current status of the load generator is also displayed in the Services window. You can stop and restart a script by selecting a node under the JMeter node and choosing an item from the popup menu.
This basic overview shows how to use a JMeter load testing script from within the IDE. For information on developing a load testing script for your application, see the following resources: