Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit and Integration Testing for ESPx and Node.js for WebSockets #15

Open
bshambaugh opened this issue Nov 26, 2022 · 3 comments
Open

Comments

@bshambaugh
Copy link
Owner

bshambaugh commented Nov 26, 2022

ESPx: https://gist.github.com/bshambaugh/384f5ba141c2acb16f8b37cb1e481149

Also try Ardunio CI, because there are issues getting Arduino code to test on the development machine otherwise.
https://www.youtube.com/watch?v=vaS4AU_PXQo
https://github.com/Arduino-CI/arduino_ci
announcement on forum: https://forum.arduino.cc/t/running-automated-unit-tests-on-an-arduino-library-using-travis-ci/512703/1

This tutorial from AdaFruit will also help with automated CI for embedded code with Travis CI and GitHub: https://learn.adafruit.com/the-well-automated-arduino-library?view=all

This post helps with Integration with Gitlab and Arduino CI and bash scipts: https://codeblog.dotsandbrackets.com/gitlab-ci-esp32-arduino/

Node.js: https://twitter.com/Brent_Shambaugh/status/1596270357631336448?s=20&t=YsuO6o2I2TP7quVKswI92g
--> I think to test all of the websocket functions in https://github.com/bshambaugh/key-did-provider-p256Test-remote I need to write integration tests:
https://thomason-isaiah.medium.com/writing-integration-tests-for-websocket-servers-using-jest-and-ws-8e5c61726b2a
--> https://github.com/ITenthusiasm/testing-websockets

@bshambaugh
Copy link
Owner Author

bshambaugh commented Nov 28, 2022

Alternatively you could try to refactor your code to use Rust:
https://www.youtube.com/watch?v=0PPPdqoDBQs
(Embedded Rust on ESP32 - Juraj Michálek - Rust Linz November 2022)

https://github.com/esp-rs

I was unable to find any tests in their repositories and not all libraries. such as websockets, are supported.

but here is how to write tests in Rust: https://doc.rust-lang.org/book/ch11-01-writing-tests.html

Alternatively, try JavaScript?
https://www.moddable.com/
They actually do have tests:
https://github.com/Moddable-OpenSource/moddable/blob/public/tests/modules/crypt/ecdsa/testvectors.js

https://github.com/Moddable-OpenSource/iot-product-dev-book/blob/master/ch3-network/websocket-client/example.js
JavaScript is compiled down to C. Can I trust what I get?

@bshambaugh
Copy link
Owner Author

bshambaugh commented Nov 28, 2022

This is bad. Arduino-CI is built around the Ardunio IDE.

Arduino-CI is built around the Arduino IDE, not platform.io. I liked Platform.io because I could break up the files in the IDE rather than rely on a single *.ino file.

There is pio ci, but is thought of as a hot key, not as a way to run tests?
https://docs.platformio.org/en/latest/core/userguide/cmd_ci.html

https://learn.sparkfun.com/tutorials/efficient-arduino-programming-with-arduino-cli-and-visual-studio-code/introduction-to-the-arduino-cli

https://forum.arduino.cc/t/does-platformio-offer-anything-more-than-arduino-cli-for-arduinos/928080

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant