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

Adding unit tests #18

Open
amotl opened this issue Jan 8, 2021 · 7 comments
Open

Adding unit tests #18

amotl opened this issue Jan 8, 2021 · 7 comments

Comments

@amotl
Copy link
Member

amotl commented Jan 8, 2021

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
Copy link
Member Author

amotl commented Jan 15, 2021

@amotl
Copy link
Member Author

amotl commented Apr 13, 2024

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
Copy link

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.

  • Arduino-CI
  • lint
  • json check
    The latter two do nothing so may be removed.

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
Copy link

RobTillaart commented Apr 14, 2024

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

@amotl
Copy link
Member Author

amotl commented Jun 23, 2024

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
Copy link

RobTillaart commented Jun 23, 2024

@amotl

Created a PR.

Please enable build.

@amotl
Copy link
Member Author

amotl commented Jun 23, 2024

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

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

2 participants