Add User
The first step you want to do every JMeter test plan is to add a Thread Group element. The thread group tells JMeter the number of users you want to impersonate, how long the user should send the request, and how many requests they should send.
continue adding Threadgroup elements first select the test plan, click your right mouse button Add a menu, then choose add a?? threadgroup .
You should now see the thread group elements under the test plan. If you don't see the elements, then "enlarge" the test plan by clicking on the elements of the planning tree test plan.
Next, you need to modify the default properties. Select the thread group element on the tree, if you have not selected it yet. You should now see the thread jmeter the Group Control Panel in the correct part of the window (see Figure 7.1)
Figure 7.1. Default values for thread groups
First, provide a more descriptive name for our thread group. In the Name field, enter the JDBC user.
you need a valid database, a database table, and a user-level access table. In the example shown here, the database is "cloud" and the table name "Vm_instance".
Next, the number of users increases to 50.
The next field of transition, leaving 10 of the value of the second. This property tells JMeter how long to start the delay between each user. For example, if you enter a 10-second transition period, JMeter will complete all your users starting at 10 seconds before the end of the year. So if we have 50 users and a 10 second transition, then start the delay between users by 200 milliseconds (10 seconds/50 users per second = 0.2 users). If you set the value to 0, then JMeter will start all of your users immediately.
Finally, 100 years enter a value for the Loop count field. This property tells JMeter how many times to repeat your test. JMeter run your test plan repeatedly, select the Always check box.
In most applications, you must manually accept the changes you made in a control panel. However, in JMeter, control Panel you let them automatically accept your changes. If you change the name of an element, this tree will be updated with the new text in the control Panel (for example, when selecting another tree element).
See Figure 7.2 Complete the JDBC User thread group.
Figure 7.2. JDBC User Thread GroupJDBC Add Request
Now that we have defined the users, it is time to define their tasks to be executed. In this section, you will specify the JDBC request execution.
The user selects the JDBC element first. Click your mouse button to get the add menu and then choose add one?? configuration element one?? JDBC Connection configuration . Then, select the new element to view its control panel (see Figure 7.3).
Set the following fields (these assumptions we will use a MySQL database called "cloud"):
- The variable name (here: myDatabase) is bound to the pool. This is required to uniquely identify the configuration. It uses the JDBC sampler to determine which configuration to use.
- MySQL database url:jdbc:://ipoftheserver:3306/Cloud
- JDBC Driver class: Com.mysql.jdbc.Driver
- User name: Database for user name
- Password: User name of password
Other areas on the screen can be used as default values.
JMeter the configuration settings for creating a database connection pool are specified in Control Panel. The JDBC request pool is referred to as the "Variable name" field. There are several different JDBC configuration elements that you can use, but they must have unique names. Each JDBC request must reference a JDBC configuration pool. More than one JDBC request can reference the same pool.
Figure 7.3. JDBC Configuration
Select the JDBC user element again. Click your mouse button to get the add menu and then choose add one?? Sampler one?? the request for JDBC . Then, select the new element to view its control panel (see Figure 7.4).
Figure 7.4. Requests from JDBC
In our test plan, we will make two JDBC requests. The first is to select all running VM instances and the second is to select "Delete" (obviously you should change the VM instance to suit your particular database). These are shown in the following example.
JMeter Send the requests in order, and you add them to the tree.
Start by editing the following properties (see Figure 7.5):
- Renamed "VM Run".
- Input pool name: "MyDatabase" (in configuration Element)
- Enter the SQL query string field.
- Enter the parameter value field "Run" value.
- The input parameter type is varchar.
Figure 7.5. JDBC requests the first SQL request
Next, add a second JDBC request and edit the following properties (see Figure 7.6):
- Changed to "virtual machine delete".
- Change the value of the parameter value to "delete".
Figure 7.6. JDBC requests a second requestadd listeners to view/store test results
The last element is one that needs to be added to your test plan Listener . This element is responsible for storing the results of all JDBC requests in a file and rendering the results.
select jdbc user Span id= "outfox_jtr_trans_node-131" class= "Outfox_jtr_trans_node" and add a summary report Listener ( add one?? listener one?? summary report ).
Save the test plan and run the test menu Run a?? start or Ctrl + an R
The listener displays the results.
Figure 7.7. Graph result Listener
JMeter Building a Database test plan