hiveeyes / hanimandl

HaniMandl ist ein halbautomatischer Honig-Abfüll-Roboter.
https://hanimandl.readthedocs.io/
GNU General Public License v3.0
38 stars 32 forks source link

Adding unit tests #18

Open amotl opened 3 years ago

amotl commented 3 years ago

Hi there,

I just discovered three nice projects and wanted to share them with you. They are AUnit [1], AUniter [2] and UnixHostDuino [3] and they will compile and execute unit tests for Arduino both natively on Linux or MacOS and by uploading to boards.

With kind regards, Andreas.

[1] https://github.com/bxparks/AUnit [2] https://github.com/bxparks/AUniter [3] https://github.com/bxparks/UnixHostDuino

amotl commented 3 years ago

@SBajonczak also referenced [1] at [2]. Thanks!

[1] https://docs.platformio.org/en/latest/plus/unit-testing.html [2] https://github.com/SBajonczak/hivemonitor/tree/master/test

amotl commented 5 months ago

We just discovered how @RobTillaart is testing his HX711 library on CI/GHA. He is using ArduinoCI, and it looks like it works pretty well enabling running unit tests without hardware present. Thanks, Rob!

References

RobTillaart commented 5 months ago

We just discovered how @RobTillaart is testing his HX711 library on CI/GHA. He is using ArduinoCI, and it looks like it works pretty well enabling running unit tests without hardware present. Thanks, Rob!

References

Did a quick test, cloned this repo and added the Arduino unit test (quick and dirty copy / strip) to it.

It appeared that the PlatformIO workflow tries to run the code in the test folder where the unit tests reside and fails. See - https://github.com/RobTillaart/hanimandl/actions

Note that I use the Arduino-CI mainly for libraries, and I used it for an application by adding an "examples" folder, in which the applications are copied as if they were examples from a library. See - https://github.com/RobTillaart/MultiSpeedI2CScanner

Configured for ESP32 platforms in .arduino-ci.yml (top folder repo) + 3 needed libraries. as hanimandl.ino uses ESP32Servo it can only compile on ESP32.

Added a badge for the Arduino CI in my repo (readme,md) for test. You need to patch the URL in the badge of course. image

Hope this helps you to get started. Rob

RobTillaart commented 5 months ago

If you want I can make a PR of my cloned repo.

amotl commented 3 months ago

Hi Rob.

I missed to respond here properly. Thank you so much for looking into this. If you could submit your improvements to the CI configuration as a PR, that would be nice indeed!

With kind regards, Andreas.

RobTillaart commented 3 months ago

@amotl

Created a PR.

Please enable build.

amotl commented 3 months ago

Thanks a stack. Approved CI runs, and they succeeded on the first attempt. Excellent!