JMeter Learning (a) Tools brief introduction

Source: Internet
Author: User
Tags http cookie xpath

First, JMeter Introduction

Apache JMeter is a 100% pure Java Desktop application that is designed to test the client/server architecture of software (such as Web applications). It can be used to test static and dynamic resource performance such as: Static files, Java servlet,cgi Scripts,java Object, database and FTP server, etc. JMeter can be used to simulate a large amount of load to test the robustness of a server, network or object, or to analyze the overall performance under different loads. at the same time, JMeter can help you perform regression testing on your application. Verify that your program has returned the expected values through the test scripts and assertions that you created. For higher adaptability, JMeter allows you to use regular expressions to create these assertions.

comparison between JMeter and LoadRunner

JMeter is an open source (with a typical open source tool features: The interface is not beautiful ) testing tools, although compared with loadrunner a lot of shortcomings, such as: It results analysis ability is not loadrunner detailed And it has many advantages:

    • Open source, he is an open source free software, use it you do not have to pay any fees,
    • Compact, compared to the size of LR (the newest LR11 will be nearly 4GB), it is very small and requires no installation, but requires a JDK environment because it is a tool developed using Java.
    • Powerful, JMeter design is just a simple Web performance test tool, but after a period of update extension, can now complete the database, FTP, LDAP, WebService and other aspects of testing. Because of its open source nature, of course you can also expand its function according to your own needs.

The biggest difference between the two:JMeter does not support IP spoofing, while LR supports it.

JMeter Disadvantages

The JS program cannot be verified using JMeter and the page UI cannot be verified, so it is necessary to complete the Web2.0 application test with selenium.

Second, JMeter download installation

1) JMeter Installation

1. http://jmeter.apache.org/Download the latest version of JMeter, unzip the file to any directory

2. Install the JDK and configure the environment variable java_home.

3. System requirements:JMeter2.11 need to JDK1.6 above version support run

4. JMeter can run on the following operating systems: Unix,windows and open VMS.

5. avoid installing jmeter in a path with a space, which will cause problems with the remote test.

2) JMeter plug-in installation

1. Plugin: http://jmeter-plugins.org/downloads/all/

2. After the plugin download: Find the Jmeterplugins-extras.jar, put the Jmeterplugins-extras.jar into the Apache-jmeter-2.12\lib\ext directory.

Third,JMeter operation

1. Enter the bin directory to run Jmeter.bat boot JMeter

Note: When opened there will be two windows, jmeter Command window and jmeter graphical operation interface, can not close the command window.

2. JMeter's classpath:

If you want to add additional jar files to JMeter's classpath, you must copy them into the Lib directory;

If you have developed a JMeter specific component or a valid jar file, copy it to the Ext directory in the Lib directory.

3. After opening the display is in Chinese, if you want to use other languages, such as English, then through the menu options, select the language--English, of course, the same operation to Chinese.

Iv.JMeter test Plan components

Open JMeter page: Includes test plan + workbench.

1. Test plan: Used to describe a performance test that contains all the functions associated with this performance test. It is said that all the content of this performance test is based on a plan.

Right-click the test Plan pop-up menu:

Note :

The function test mode check box, if selected, causes JMeter to record every sampled data returned from the server. If you select a file in the test listener, the data will be written to the file. This is useful if you try a smaller test to ensure that the JMeter is configured correctly and that your server is returning the desired results. The consequence of this is that the file will grow rapidly and the efficiency of the jmeter will be affected.

If you do not log data to a file, this option is no different.

2. Threads (users) thread user

Although there are three options to add a thread group, the name is different and the interface is exactly the same after creation. The previous version has only one thread group name. Now one more setup Theread Group and Terdown Thread Group

1) Setup Thread Group

A special type of threadgroup that can be used to perform a predictive pilot operation. These threads behave exactly like a normal thread-group component. The difference is that these types of threads perform a regular thread group execution before testing.

The SetUp Thread Group is similar to the LR init. Can be used to perform a predictive pilot operation.

2) teardown thread group.

A special type of threadgroup that can be used to perform post-test actions. These threads behave exactly like a normal thread-group component. The difference is that these types of threads perform periodic thread groups after the test is finished.

The TearDown Thread Group is similar to the end of LR. can be used to perform post-test actions.

3) thread group (thread groups).

This is the thread that we usually add to run. In layman's words, a thread group, which can be viewed as a virtual user group, can be understood as a virtual user by each thread in the thread group. The number of threads contained in a thread group does not change during test execution.

Thread Group:

Name: As a literal meaning, a meaningful name.

Comments:

Number of Threads: select here 5

ramp-up Period: Unit is seconds, default time is 1 seconds. It specifies the time it takes to start all threads, for example, the current setting means "Start 5 threads in 5 seconds, each thread has a 1-second interval." If you need jmeter to start all threads immediately, set this to 0

Number of cycles: Indicates how many requests each thread executes.

3. Test fragment (Testing Fragment)

The test fragment element is a special group of threads on the controller that is at the same level as the thread group on the test tree. It differs from the thread group because it is not executed unless it is a module controller or is referenced by the controller.

Controller

The jmeter has two types of controllers: Sampler (sample) and logic controller, which are used to drive a test with these originals.

4. Sampling Device (Sampler)

A sampler (Sampler) is a performance test that sends a request to the server, records the response information, records the minimum unit of response time, JMeter native support for many different Sampler, such as HTTP request Sampler, FTP request Sampler, TCP Request Sampler, JDBC request Sampler, and so on, each of the different types of Sampler can make different types of requests to the server based on the parameters set.

Of all the sampler in JMeter, Java Request Sampler and BeanShell Requst Sampler are two special customizable sampler.

5. Logical controller (logic Controllers)

Logic controllers, including two types of none, are controllers used to control the logical order of the sampler node sending requests in Test plan, commonly used if (if) controller, switch controller, Runtime controller, loop controllers, etc. The other is used to organize the control of sampler to nodes, such as transaction controller, throughput controller.

6, configuration element (config Element)

The configuration element (config Element) is used to provide support for static data configuration. The CSV data Set config can form a data pool for the local data file, while the configuration for the types of HTTP request sampler and TCP Request Sampler can modify the default data for sampler.

For example, the HTTP cookie manager can be used to manage HTTP Request Sampler cookies.

The HTTP request default value does not trigger JMeter to send HTTP requests, but simply defines the default properties of the HTTP request.

7, Timers (timer)

Timers are used to set the wait time between operations, and the wait time is a common means of controlling the client's QPS in performance testing . Similar to the "Think Time" inside the LoadRunner. JMeter definesdifferent types of timers, such as bean Shell Timer, Constant throughput timer, fixed timer, and so on.

8. Front processor (Per processors)

The predecessor processor is used for special processing of the incoming request before the actual request is made. For example, the HTTP URL rewrite modifier can implement URL rewriting, and when there is a SessionID class of session information in Rul, the actual sessionid that make the request can be populated with the processor.

9. Post Processor (post processors)

The post processor is used to process the server response resulting from a request made by the sampler. Typically used to extract specific data in a response (similar to the concept of association in a LoadRunner test tool). For example, an XPath Extractor can be used to extract data from the response data that is obtained from a given XPath value, and a regular expression extractor that extracts the data obtained from a regular expression in the response data.

10. Assertion (Assertions)

Assertions are used to check if the appropriate data obtained in a test is expected, and assertions are typically used to set checkpoints to ensure that the data interactions in the performance test process are consistent with expectations.

11. Monitor (Listener)

This listener is not a component that listens to system resources. It is a series of components used to process and visualize test results data. graphical results, viewing result trees, aggregated reports, and table view results are all the components we use frequently.

Five, the Workbench

In the test we may need to change some components temporarily, you can save some components that need to be changed in the workbench, and then restore after the test is complete, but remember: you cannot exit JMeter. Once you exit JMeter, the contents of the workbench disappear.

1, Workbench-Non-test element-property Display, This component is equivalent to the Jmeter.properties GUI.

Vi. Help

Http://jmeter.apache.org/usermanual/component_reference.html

The best help is: menu-"Help"-"help".

Here, we have a simple understanding of the basic composition of the jmeter, our post-test work is to use these components to complete the test task.

JMeter Learning (a) Tools brief introduction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.