Messaging Server publish / subscribe Transfer Protocol - 1, MQTT is a client-based. MQTT agreement is lightweight, simple, open and easy to implement, these features make it suitable for a very wide range, how to use a simple introduction to the JMeter under article MQTT do performance testing protocol
2, to test the MQTT protocol, you need to download a mqtt- xmeter-jar-with-dependencies.jar plug placed under the JMeter lib / ext directory download method, see end of article
First, add a thread group
- Add thread group, Jmeter execution is driven by a thread group, the test plan must have at least one thread group, select the test program, right click, add the "thread" thread group
two, followed by adding the following request
- Add to create a connection request - select the thread group, right click, add "sampler" MQTT Connect
- The action of the connection request is carried out, this time using the machine turned MQTT service test, so ip is 127.0.0.1, the default port 1883
- Add release request - select the thread group, right click, add "sampler" MQTT Pub Sampler
- The request to the server role is to publish a message, just type theme, sending the message type, message content can be sent
- Add a subscription request - select the thread group, right click, add "sampler" MQTT Sub Sampler
- The role is to request a subscription news release, just type the name of the theme, you can subscribe
- Because of our testing process generally only need to connect once, so this also adds a controller only once, the effect of this controller is a thread only once, no matter how many times the loop executes, right thread group "Add" logic controller " only a controller
-
Add tree view, right thread group, add "listener, tree view, the function of this component is to view the results of specific request parameters and the response of each request
Third, the test is performed
- Click the implementation of the case, the development of a good script execution results are as follows:
- MQTT background publishing records
If the article helpful, I welcome attention to public numbers, the public numbers this article synchronized platform, facilitate access, I will continue to introduce articles related to testing, testing technology to share with you, each one original article is carefully written to you eliminate plagiarism copy
QQ technical exchange group: the group please enter this information 51CTO
Micro-channel two-dimensional code number of public attention:
After attention, resources download reply, you can get a variety of shared resources Download