SDK docs menu

class

UnitTestReport

The results of a test binary's run, from Board.run_unit_tests.

from hardlabs_sdk import UnitTestReport

Usage

report = board.run_unit_tests(within=120)
open("results.xml", "w").write(report.junit())
assert report.ok, report.summary()

Attributes

caseslist[TestCase]
Every test the console reported, in order.
finishedbool
Whether the run's summary line (or done) appeared.
frameworkstr | None
unity or googletest, from its output.

UnitTestReport.okproperty

True when the run finished, ran at least one test, and none failed.

report.ok -> bool

UnitTestReport.summarymethod

Returns a count of passed, failed and skipped tests, then each failure with its message.

report.summary() -> str

Returns

str — The summary, for an assertion message or a log.

UnitTestReport.junitmethod

Returns the results as JUnit XML, which CI services show as test results.

report.junit(suite='on-target') -> str

Arguments

suitestrdefault 'on-target'
The test suite's name in the report.

Returns

str — The XML document.