Skip to content

Test scenario

jinfahua edited this page Feb 7, 2017 · 17 revisions

This page includes the test scenarios for MQTT JMeter plugin.

Test execution records

7th, Feb, 2017

Test environment

  • JMeter 3.1
  • Mac OS 10.12.2
  • EMQ server
  • ...

Bugs found

  • ...

Pre-steps - Install JMeter MQTT plugin

  1. Follow install instruction to install the MQTT JMeter plugin.
  2. Install a MQTT server. In below test, EMQ is used. Follow EMQ install instruction to install EMQ.

Connection sampler

TCP connection scenario 1: successful TCP connection in UI mode

  • Open JMeter, and create a threadgroup, and rename it to 'MQTT connections', then add a 'MQTT Connection Sampler' under 'MQTT connections'.
  • In "Server name or IP", input the MQTT server address that installed in pre-steps.
  • In "Port number", input the port number that used by MQTT server.
  • In "Keep alive(s)", input 20, which means that the ping packet will be sent every 20 sec.
  • In "Connection keep time(s)", input 60, which means that the connection will keep 1 minute after connected successfully.
  • Keep rests of controls unchanged.
  • Right click thread group 'MQTT connections', then add 'View Results Tree', save the test script.
  • Click 'Run' button in toolbar, make sure no exceptions are found in JMeter log.
  • Make sure the sampler results in 'View Results Tree' are correct.
  • Open EMQ server admin console and make sure: 1) The connection was created successfully. 2) After 20 seconds, a ping packet should be found. 3) The connection keeps 1 minutes, and a disconnect packet should be found.
  • Click thread group 'MQTT connections', and change 'Number of Threads (users)' to 50, and validate conn/disconn/ping packets numbers in EMQ admin console.

TCP connection scenario 2: successful TCP connection in none-UI mode

  • Restart EMQ server.
  • Close JMeter, and run the previous testcase in none-ui mode, validate conn/disconn/ping packets numbers in EMQ admin console.

TCP connection scenario 3: successful TCP connection in UI mode and break the test during running

  • Open JMeter and test script created in last step.
  • In "Connection keep time(s)", change 60 to 120, so the connection will keep 2 minutes after connecting successfully.
  • Run the test, and keep it running in 1 min, validate conn/ping packets numbers in EMQ admin console.
  • Stop the test, and make sure the test can be finished soon.

TCP connection scenario 4: successful TCP connection in non-UI mode and break the test during running

  • Open JMeter and test script created in last step.
  • In "Connection keep time(s)", change 60 to 120, so the connection will keep 2 minutes after connecting successfully.
  • Close JMeter, and run the test in non-ui mode, and keep it running in 1 min, validate conn/ping packets numbers in EMQ admin console.
  • Stop the test by ctrl+c, and make sure the test can be finished soon.

TCP connection scenario 5: failed TCP connection in UI mode

  • Open JMeter and test script created in last step.
  • In "Server name or IP", change to an IP address that can be accessed by your JMeter but not install with EMQ server, save the script, and run it.
  • Validate the script is failed quickly, and sampler results in 'View Results Tree' displayed with failed message.

TCP connection scenario 6: failed TCP connection in none-UI mode

  • Open JMeter and test script created in last step.
  • In "Server name or IP", change to an IP address that can be accessed by your JMeter but not install with EMQ server, save the script.
  • Run the script in none-ui mode, make sure the script is failed quickly.

TCP connection scenario 7: successful TCP connection with user authentication in ui mode

  • Change the EMQ configuration to add user authentication, and restart EMQ server.
  • Open the last test scenario, and change 'User name' and 'Password' value to configurations in previous step.
  • Run the test and validate as last scenario.
  • Disable EMQ configuration not to use the user authentication.

TCP connection scenario 8: successful SSL connection in ui mode

  • Change EMQ configuration to support SSL, and restart EMQ server.
  • Open the last test script, and remove 'User name' and 'Password' value of 'User authentication' section.
  • In 'Port number', change it to the SSL port.
  • Select 'SSL' in 'Protocols' dropdown box.
  • Save the script, and run it, validate conn/disconn/ping packet num in EMQ admin console.

TCP connection scenario 9: successful dual-SSL connection in ui mode

  • Change EMQ configuration to support dual-SSL, and restart EMQ server.
  • Open the last test script, and check 'Dual SSL authentication', follow steps in Certification files for SSL/TLS connections section to enable dual SSL configurations.
  • Save the script, and run it, validate conn/disconn/ping packet num in EMQ admin console.

TCP connection scenario 10: 100000 TCP connection

  • Change EMQ configuration back to normal TCP connection, and restart EMQ server.
  • Open JMeter, and create a threadgroup, and rename it to 'MQTT connections', then add a 'MQTT Connection Sampler' under 'MQTT connections'.
  • In "Server name or IP", input the MQTT server address that installed in pre-steps.
  • In "Port number", input the port number that used by MQTT server.
  • In "Connection keep time(s)", input 600, which means that the connection will keep 10 minutes after connected successfully.
  • Keep rests of controls unchanged.
  • Save the script and upload it to xmeter.net.
  • Run the script with 100000 virtual user and 12 minutes, validate conn/disconn/ping packet num in EMQ admin console.

Pub sampler

Sub sampler

Clone this wiki locally