Link Search Menu Expand Document Edit GitHub

Test


Runs tests against the specified broker to find out its features and limitations.

By default the test command will use MQTT 3 clients to test the broker first and will afterwards check the connect restrictions returned by a connect of a MQTT 5 client. You can alter this behavior by specifying different options when using the command.

Example

$ mqtt test -h broker.hivemq.com
MQTT 3: OK
	- Maximum topic length: 65535 bytes
	- QoS 0: Received 10/10 publishes in 47,59ms
	- QoS 1: Received 10/10 publishes in 68,87ms
	- QoS 2: Received 10/10 publishes in 43,18ms
	- Retain: OK
	- Wildcard subscriptions: OK
	- Shared subscriptions: OK
	- Payload size: >= 100000 bytes
	- Maximum client id length: 65535 bytes
	- Unsupported Ascii Chars: ALL SUPPORTED
MQTT 5: OK
	- Connect restrictions: 
		> Retain: OK
		> Wildcard subscriptions: OK
		> Shared subscriptions: OK
		> Subscription identifiers: OK
		> Maximum QoS: 2
		> Receive maximum: 10
		> Maximum packet size: 268435460 bytes
		> Topic alias maximum: 5
		> Session expiry interval: Client-based
		> Server keep alive: Client-based

Synopsis

mqtt test   [--help]
            [-V=<version>]
            [-a]
            [-t=<timeOut>]
            [-q=<qosTries>]
            [-l]
            [-s]
            [-pw[=<password>]] 
            [-pw:env[=<passwordFromEnv>]]
            [--cert=<clientCertificate>] 
            [-h=<host>] 
            [--key=<clientPrivateKey>]
            [-p=<port>] 
            [-pw:file=<passwordFromFile>] 
            [-t=<timeOut>] 
            [-u=<user>] 
            [--cafile=FILE]... 
            [--capath=DIR]...
            [--ciphers=<cipherSuites>[:<cipherSuites>...]]... 
            [--tls-version=<supportedTLSVersions>]...

Test options

OptionLong VersionExplanationDefault
-V--mqttVersionThe MQTT version to test the broker on.Both versions will be tested
-a--allPerform all tests for all MQTT versionsfalse (Only test MQTT 3)
-t--timeOutThe time to wait for the broker to respond (in seconds).10s
-q--qosTriesThe amount of messages to send and receive from the broker for each QoS level.10
-l Log to ~./mqtt.cli/logs (Configurable through ~/.mqtt-cli/config.properties)false

Connect Options

OptionLong VersionExplanationDefault
-h--hostThe MQTT host.localhost
-p--portThe MQTT port.1883

Security Options

OptionLong VersionExplanationDefault
-s--secureWhether a default SSL configuration is used.false
-u--userDefine the username for authentication. 
-pw--passwordDefine the password for authentication directly.
If left blank the user will be prompted for the password in console.
 
-pw:env Define that the password for authentication is read in from an environment variable.MQTT_CLI_PW if option is specified without value
-pw:file Define the path to a file from which the password is read in. 
 --certThe path to the client certificate to use for client-side authentication. 
 --keyThe path to the corresponding private key for the given client certificate. 
 --cafileThe path to the file containing a trusted CA certificate to enable encrypted certificate based communication. 
 --capathThe path to the directory containing trusted CA certificates to enable encrypted certificate based communication. 
 --ciphersThe supported cipher suites in IANA string format concatenated by the ‘:’ character if more than one cipher should be supported.
e.g TLS_CIPHER_1:TLS_CIPHER_2
See IANA Format for supported cipher suite strings.
 
 --tls-versionThe TLS version to use - TLSv1.1 TLSv1.2 TLSv1.3TLSv1.2

Further Examples

Perform tests for MQTT 5 only

$ mqtt test -h broker.hivemq.com -a -V 5
MQTT 5: OK
	- Connect restrictions: 
		> Retain: OK
		> Wildcard subscriptions: OK
		> Shared subscriptions: OK
		> Subscription identifiers: OK
		> Maximum QoS: 2
		> Receive maximum: 10
		> Maximum packet size: 268435460 bytes
		> Topic alias maximum: 5
		> Session expiry interval: Client-based
		> Server keep alive: Client-based
	- Maximum topic length: 65535 bytes
	- QoS 0: Received 10/10 publishes in 52,70ms
	- QoS 1: Received 10/10 publishes in 79,95ms
	- QoS 2: Received 10/10 publishes in 125,65ms
	- Retain: OK
	- Wildcard subscriptions: OK
	- Shared subscriptions: OK
	- Payload size: >= 100000 bytes
	- Maximum client id length: 65535 bytes
	- Unsupported Ascii Chars: ALL SUPPORTED

Test receving of 100 publishes in 10s (for each qos level)

$ mqtt test -h broker.hivemq.com -q 100 
...
    - QoS 0: Received 100/100 publishes in 123,44ms
    - QoS 1: Received 100/100 publishes in 223,78ms
    - QoS 2: Received 100/100 publishes in 340,81ms
...

Table of contents