|
59 | 59 | | | ... | Subscribe to MQTT Broker and Validate | client.id=${client} | topic=${topic} | message=whatever |
60 | 60 | | | Publish to MQTT Broker and Disconnect | topic=${topic} | message=${message} | qos=1 |
61 | 61 | | | Subscribe to MQTT Broker and Validate | client.id=${client} | topic=${topic} | message=${regex} |
| 62 | + |
| 63 | +| Subscribe for the first time and validate that no messages are received |
| 64 | +| | Sleep | 1s |
| 65 | +| | ${time} | Get Time | epoch |
| 66 | +| | ${client} | Catenate | SEPARATOR=. | robot.mqtt | ${time} |
| 67 | +| | ${topic} | Set Variable | test/mqtt_test_sub |
| 68 | +| | @{messages} | Subscribe and Get Messages | client.id=${client} | topic=${topic} | timeout=5s |
| 69 | +| | LOG | ${messages} |
| 70 | +| | Length Should Be | ${messages} | 0 |
| 71 | + |
| 72 | +| Subscribe, publish 1 message and validate it is received |
| 73 | +| | Sleep | 1s |
| 74 | +| | ${time} | Get Time | epoch |
| 75 | +| | ${client} | Catenate | SEPARATOR=. | robot.mqtt | ${time} |
| 76 | +| | ${topic} | Set Variable | test/mqtt_test_sub |
| 77 | +| | Subscribe and Get Messages | client.id=${client} | topic=${topic} |
| 78 | +| | Publish to MQTT Broker and Disconnect | topic=${topic} | message=test message | qos=1 |
| 79 | +| | @{messages} | Subscribe and Get Messages | client.id=${client} | topic=${topic} |
| 80 | +| | LOG | ${messages} |
| 81 | +| | Length Should Be | ${messages} | 1 |
| 82 | +| | Should Be Equal As Strings | @{messages}[0] | test message |
| 83 | + |
| 84 | +| Subscribe with no limit, publish multiple messages and validate they are received |
| 85 | +| | Sleep | 1s |
| 86 | +| | ${time} | Get Time | epoch |
| 87 | +| | ${client} | Catenate | SEPARATOR=. | robot.mqtt | ${time} |
| 88 | +| | ${topic} | Set Variable | test/mqtt_test_sub |
| 89 | +| | Subscribe and Get Messages | client.id=${client} | topic=${topic} |
| 90 | +| | Publish to MQTT Broker and Disconnect | topic=${topic} | message=test message1 | qos=1 |
| 91 | +| | Publish to MQTT Broker and Disconnect | topic=${topic} | message=test message2 | qos=1 |
| 92 | +| | Publish to MQTT Broker and Disconnect | topic=${topic} | message=test message3 | qos=1 |
| 93 | +| | @{messages} | Subscribe and Get Messages | client.id=${client} | topic=${topic} | limit=0 |
| 94 | +| | LOG | ${messages} |
| 95 | +| | Length Should Be | ${messages} | 3 |
| 96 | +| | Should Be Equal As Strings | @{messages}[0] | test message1 |
| 97 | +| | Should Be Equal As Strings | @{messages}[1] | test message2 |
| 98 | +| | Should Be Equal As Strings | @{messages}[2] | test message3 |
| 99 | + |
| 100 | +| Subscribe with limit |
| 101 | +| | Sleep | 1s |
| 102 | +| | ${time} | Get Time | epoch |
| 103 | +| | ${client} | Catenate | SEPARATOR=. | robot.mqtt | ${time} |
| 104 | +| | ${topic} | Set Variable | test/mqtt_test_sub |
| 105 | +| | Subscribe and Get Messages | client.id=${client} | topic=${topic} |
| 106 | +| | Publish to MQTT Broker and Disconnect | topic=${topic} | message=test message1 | qos=1 |
| 107 | +| | Publish to MQTT Broker and Disconnect | topic=${topic} | message=test message2 | qos=1 |
| 108 | +| | Publish to MQTT Broker and Disconnect | topic=${topic} | message=test message3 | qos=1 |
| 109 | +| | @{messages} | Subscribe and Get Messages | client.id=${client} | topic=${topic} | limit=1 |
| 110 | +| | LOG | ${messages} |
| 111 | +| | Length Should Be | ${messages} | 1 |
| 112 | +| | Should Be Equal As Strings | @{messages}[0] | test message1 |
| 113 | +| | @{messages} | Subscribe and Get Messages | client.id=${client} | topic=${topic} | limit=2 |
| 114 | +| | LOG | ${messages} |
| 115 | +| | Length Should Be | ${messages} | 2 |
| 116 | +| | Should Be Equal As Strings | @{messages}[0] | test message2 |
| 117 | +| | Should Be Equal As Strings | @{messages}[1] | test message3 |
| 118 | + |
| 119 | +| Unsubscribe and validate no messages are received |
| 120 | +| | Sleep | 1s |
| 121 | +| | ${time} | Get Time | epoch |
| 122 | +| | ${client} | Catenate | SEPARATOR=. | robot.mqtt | ${time} |
| 123 | +| | ${topic} | Set Variable | test/mqtt_test_sub |
| 124 | +| | Subscribe and Get Messages | client.id=${client} | topic=${topic} |
| 125 | +| | Publish to MQTT Broker and Disconnect | topic=${topic} | message=test message1 | qos=1 |
| 126 | +| | @{messages} | Subscribe and Unsubscribe | client.id=${client} | topic=${topic} |
| 127 | +| | Publish to MQTT Broker and Disconnect | topic=${topic} | message=test message2 | qos=1 |
| 128 | +| | @{messages} | Subscribe and Get Messages | client.id=${client} | topic=${topic} |
| 129 | +| | LOG | ${messages} |
| 130 | +| | Length Should Be | ${messages} | 0 |
0 commit comments