Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/getlarge/mqtt-declarative-e2e-test
Test generator for MQTT
https://github.com/getlarge/mqtt-declarative-e2e-test
e2e-tests mocha mqtt test-automation
Last synced: 3 days ago
JSON representation
Test generator for MQTT
- Host: GitHub
- URL: https://github.com/getlarge/mqtt-declarative-e2e-test
- Owner: getlarge
- Created: 2020-05-10T07:48:41.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-03-26T16:36:03.000Z (over 2 years ago)
- Last Synced: 2024-04-24T08:15:32.120Z (7 months ago)
- Topics: e2e-tests, mocha, mqtt, test-automation
- Language: JavaScript
- Size: 28.3 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# mqtt-declarative-e2e-test
`mqtt-declarative-e2e-test` allows to write tests for MQTT clients in an object definition style.
```js
const e2eTestsSuite = {
[`[TEST] Sensor E2E Tests`]: {
tests: {
"Publish test X": {
tests: [
{
skip: false,
name: "Can publish",
options: () => {},
url: () => `mqtt://${mqttUrl}`,
verb: "publish",
packet: () => ({
topic: "testTopic",
payload: "testPayload",
}),
timeout: 150,
expect: async (packet) => {
expect(packet.payload).to.be.equal(testPayload);
},
error: (err) => {
throw err;
},
},
],
},
"Publish / subscribe test X": {
tests: [
{
name: "Can subscribe and receive message",
options: () => {},
url: () => `mqtt://${mqttUrl}`,
error: (err) => {
throw err;
},
steps: [
{
verb: "subscribe",
packet: () => ({
topic: `12345-in/1/#`,
}),
timeout: 200,
expect: (message) => {
expect(message.topic).to.be.equal("12345-in/1/3303/0/1/5700");
expect(message.payload).to.be.equal("42");
},
},
() => ({
verb: "publish",
packet: () => ({
topic: "12345-in/1/3303/0/1/5700",
payload: "42",
}),
timeout: 300,
}),
],
},
],
},
},
},
};
```It uses [Mocha][mocha] and exposes its BDD API.
## Installation
```bash
npm install --save-dev mqtt-declarative-e2e-test# or
npm i -D mqtt-declarative-e2e-test
```## Issues
Please share your feedback and report the encountered issues on the [project's issues page][projectissues].
[projectissues]: https://github.com/marc-ed-raffalli/declarative-test-structure-generator/issues
[mocha]: https://mochajs.org/