Using JMeter test protocol MQTT

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

  1. 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
    Here Insert Picture Description
    two, followed by adding the following request
  2. Add to create a connection request - select the thread group, right click, add "sampler" MQTT Connect
    Here Insert Picture Description
  3. 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
    Here Insert Picture Description
  4. Add release request - select the thread group, right click, add "sampler" MQTT Pub Sampler
    Here Insert Picture Description
  5. The request to the server role is to publish a message, just type theme, sending the message type, message content can be sent
    Here Insert Picture Description
  6. Add a subscription request - select the thread group, right click, add "sampler" MQTT Sub Sampler
    Here Insert Picture Description
  7. The role is to request a subscription news release, just type the name of the theme, you can subscribe
    Here Insert Picture Description
  8. 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
    Here Insert Picture Description
  9. 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
    Here Insert Picture Description

    Third, the test is performed

  10. Click the implementation of the case, the development of a good script execution results are as follows:
    Here Insert Picture Description
  11. MQTT background publishing records
    Here Insert Picture Description

       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
              Here Insert Picture Description


Micro-channel two-dimensional code number of public attention:

            Here Insert Picture Description


After attention, resources download reply, you can get a variety of shared resources Download

\ [Picture dump outside the chain fails, the source station may have a security chain mechanism, it is recommended to save the pictures uploaded directly down (img-dkyHNY2D-1569554485737) (https://s1.51cto.com/images/blog/201908/06/ 2e62f8806e1dc1c391c4332ac7fd70b1.png? x-oss-process = image / watermark, size_16, text_QDUxQ1RP5Y2a5a6i, color_FFFFFF, t_100, g_se, x_10, y_10, shadow_90, type_ZmFuZ3poZW5naGVpdGk =) \]

Guess you like

Origin blog.51cto.com/6183574/2455093