Jmeter test - http request

<div class="iteye-blog-content-contain" style="font-size: 14px"></div>

 I started to contact Jmeter test in the past few days. I feel this tool is very convenient. It can more realistically simulate multi-user concurrent requests.

 

Step 1: Download the Jmeter compressed package from the official website. After decompression, two environment variables need to be configured.

            1. Create the JMETER_HOME system variable, the value of which is the path after Jmeter is decompressed. Example: E:\apache-jmeter-2.6          

            2. Add after the CLASSPATH system variable

            %JMETER_HOME%\lib\ext\ApacheJMeter_core.jar;

            %JMETER_HOME%\lib\jorphan.jar;

            %JMETER_HOME%\lib\logkit-1.2.jar;

 

Step 2: Write a simple Http request test plan.

            1. Run the Jmeter.bat command in the bin directory of Jmeter. A command box pops up, and after a few seconds, Jmeter pops up

 Visual interface. Prove that the environment variables are configured successfully.

 

            2. In the test plan, right-click to create - thread group.

             Thread group: Represents a certain number of concurrent users, which can be used to simulate concurrent users sending requests. The actual request content is defined in Sampler, which is contained by the thread group. It can be established in "Test Plan -> Add -> Thread Group", and then there are several input fields in the Thread Group panel: the number of threads, Ramp-Up Period (in seconds), and the number of cycles, where Ramp-Up Period ( in seconds) means that all threads are created within this time. If there are 8 threads, Ramp-Up = 200 seconds, then the thread start time interval is 200/8 = 25 seconds. The advantage of this is that it will not put too much load on the server at the beginning. Thread groups are designed to simulate concurrent loads. 

             Create HTTP request. Thread Group - Add - Sampler - HTTP Request.

              This is to send a request to Baidu's homepage.

               request with parameters

               

          ${socialPlatform}, ${queryname} here refers to the data in the csv file.

           Thread Group - Configuration File - CSV Data Set Config.

           Filename: The absolute path to your csv file.

           Variable Names: The reference name of the parameter you need to pass in, corresponding to the above, here is: socialPlatform, queryname. Separate them with commas.

           Then you create a csv file locally, with each row representing a thread reference data. The order corresponds to the order in which the Variable Names were set earlier .

 

           3. Display the results

                Thread Group - Listener - Aggregate Report / View Result Tree /  …

                 

              

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327073674&siteId=291194637