Guides
On-target unit tests
A test binary built for the board's processor runs on the simulated one. Board.run_unit_tests reads the Unity or GoogleTest results it prints on the console.
Run the tests
from hardlabs_sdk import Client
with Client().start("company_name/board_name", "build/tests.elf") as board:
report = board.run_unit_tests(within=120)
open("results.xml", "w").write(report.junit())
assert report.ok, report.summary()UnitTestReport.junit writes JUnit XML, which most CI services display as test results. UnitTestReport.summary counts the results and lists each failure.
Runs that don't finish
Collection stops at the framework's summary line. If it doesn't appear within within simulated seconds, you still get a report, with finished set to False and ok set to False. If your binary prints no summary, pass the line that ends the run:
report = board.run_unit_tests(done="ALL TESTS DONE")