Jmeter entry level - first article

The main content of this blog is:

1: This article mainly introduces the use of jmeter+badboy and the introduction of jar packages and simple code calls by jmeter

The preconditions are:

The configuration of jdk and jmeter on the computer is ok. If jmeter, jdk and badboy are not installed, you can refer to the following link to download

1: JMeter installation

1 http://jmeter.apache.org/ Download the latest version of jmeter and install it to any directory

2 Install JDK and configure the environment variable JAVA_HOME.

3 System requirements: JMeter2.11 requires JDK1.6 or above to support running

4 JMeter can run on the following operating systems: Unix, Windows and Open VMS.

5:  Avoid installing JMeter in a path with spaces , this will cause problems with remote testing.

2: badboy installation here is the download link and password fool installation

Link: https://pan.baidu.com/s/1NAhPHllphjRIkkqKdi5ffg Password: 2mta


Not much nonsense and start to formally explain the use of jmeter+badboy

First of all, let me explain the simple use of badboy:

First of all, I will briefly introduce the simple use of badboy. I will not introduce the other functions of badboy by myself.


At present, it is ready to start recording, and you can record by entering the web address connection to be tested at the connection.



After entering www.baidu.com, the recording operation was performed

A simple script has been recorded, so how to export it so that jmeter can open it?

The following figure shows how to export the script

first step:




Step 2 Click here


The third step is to select a save location, the name can be modified by yourself, this article uses the default name





After clicking save, you can see a file with the suffix .jmx on the desktop, and then use our jmeter to open it


Let's first introduce the jmeter interface

After opening jmeter, there are test plans and workbenches

1. Test Plan  : used to describe a performance test, including all functions related to this performance test, that is to say, all the content of this performance test is based on a plan.

Right-click on the Test plan popup menu:


About: function test mode It is recommended that you use Baidu to research and use it. There are many online columns that can be used by Baidu. This article will not explain it.

 

2. Threads (Users) thread user


setUp theread Group 与terDown Thread Group

1:setup thread group 

A special type of ThreadGroup that can be used to perform pre-test operations. These threads behave exactly like a normal thread group element. The difference is that these types of threads perform periodic thread group execution before executing tests.

setUp Thread Group is similar to lr's init. It can be used to perform pre-test operations.

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 element. The difference is that these types of threads execute periodic groups of threads after the execution of the test.

tearDown Thread Group is similar to lr's end. Can be used to perform post-test actions.

3: thread group (thread group).

     This is the thread we usually add to run. Generally speaking, a thread group can be regarded as a virtual user group, and each thread in the thread group can be understood as a virtual user. The number of threads contained in a thread group does not change during test execution.

Thread group:

  Name: Just like the literal meaning, just give a meaningful name

  Notes:

  Number of threads: There is no limit to the data of 5 threads selected here, you can feel free, but the more threads, the more CPU occupied, and the computer will be very stuck if you open too much.

  Ramp-Up Period: The unit is seconds, the default time is 1 second. It specifies the time it takes to start all threads, e.g. the current setting says "start 5 threads in 5 seconds with a 1 second interval between each thread". If you need Jmeter to start all threads immediately, set this to 0

  Number of loops: Indicates how many times each thread executes the request.


The following is a brief introduction to the functions and uses of jmeter's listeners

What I often use is: viewing the result tree, aggregation reports, viewing the results in a table, you can add your own attempts


The following picture shows the operation of opening the homepage to log in by using the product of my company to record


Because after recording the script, it is found that the login operation fails if it is run. The reason for the failure is that the recorded script does not encrypt the password into md5 format (there is no interface document that is more pitted... not much to say), It is found that the login password needs to be encrypted. All I call a base64 jar package to solve this problem by calling the java code. The following is an introduction to the solution process.

First I downloaded a base64 jar package and put it into jmeter

The first step is to put the jar package into jmeter


The next step is to call the method of the jar package to encrypt the password

Here we need to add a BeanShell Sampler


The next step is to pass the encrypted parameter into the encrypted value in my login interface parameters.




I have a very shallow use and understanding of jmeter+badboy. Don't spray it. If there are mistakes or mistakes, I hope everyone will criticize and correct them. Thank you

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325940043&siteId=291194637