Commit Graph

24 Commits (962ae83b664120e6272e426b16a462e2a1ed923f)

Author SHA1 Message Date
Niklas Hauser 2e71820fa9 Cleanup confusing default handler namings. 2016-04-28 15:20:40 -05:00
Przemek Wirkus 59fc24ccb2 Refactor failure_handler(s) 2016-04-28 15:20:01 -05:00
Przemek Wirkus 982a06cf33 Port tests to Async API feature 2016-04-28 15:19:53 -05:00
Niklas Hauser e68d00ded5 Add location to failure information.
Rename `failure_t` to `failure_reason_t`.
Add `location_t` with stringify function.
Add new `failure_t` struct with location information.
Adapt harness logic to keep track of location.
Add a test failure handler that reports assertion failures
on test setup and test teardown.
2016-04-28 15:19:29 -05:00
Niklas Hauser 49952824fb Handlers: Add specialized functions for all handlers.
Most of them simply forward to the verbose handlers,
however, should we decide differently in the future,
existing unit tests will not have to be adapted.
2016-04-28 15:18:53 -05:00
Niklas Hauser 633588dc35 Handlers: Add test failure handler to allow selftest. 2016-04-28 15:18:34 -05:00
Niklas Hauser 105d07b552 Harness: Allow generic ignoring of failures. 2016-04-28 15:18:30 -05:00
Niklas Hauser 67e271f292 Harness: Implement test case repeat on timeout.
This is particularly useful for network unittests that may timeout, but
are allowed to retry a number of times, before being declared a failure.
2016-04-28 15:18:25 -05:00
Niklas Hauser c2343b223b Update namespace from v0 to v1. 2016-04-28 15:18:08 -05:00
Niklas Hauser 13987f8101 Adapt include path for header file move to `utest`. 2016-04-28 15:17:55 -05:00
Niklas Hauser 97bbff7ab2 Refactor namespace `mbed::test` to `utest`. 2016-04-28 15:17:43 -05:00
Niklas Hauser 61fe8e07a1 Handlers: Remove forced newline after assertion failure.
This was a workaround for unity's failure to add a newline after
printing an assertion failure.
This has been fixed in unity.
2016-04-28 15:17:25 -05:00
Niklas Hauser 64573c33d0 Types: allow external access to `stringify` function. 2016-04-28 15:17:21 -05:00
Niklas Hauser a045c44f78 Refactor `set_up` to `setup`, `tear_down` to `teardown`. It's a verb vs. noun thing. 2016-04-28 15:17:14 -05:00
Niklas Hauser 7e321f8f81 Defaults: Force users to provide a greentea setup handler.
It displays a helpful message in case you forgot.
2016-04-28 15:16:55 -05:00
Niklas Hauser e2a5d97f77 Harness: Add empty test case detection. 2016-04-28 15:16:44 -05:00
Niklas Hauser 8d84612472 Harness: Add correct handling of failures in setup and teardown handlers. 2016-04-28 15:16:36 -05:00
Niklas Hauser cbac633aa5 Defaults: Remove unnecessary namespaces. 2016-04-28 15:16:31 -05:00
Niklas Hauser 303fa5a3a0 Defaults: Make Greentea handlers more verbose. 2016-04-28 15:16:28 -05:00
Niklas Hauser ad8fdc62d6 Defaults: Set greentea default handlers. 2016-04-28 15:16:24 -05:00
Niklas Hauser 64f54ed35c Harness: Call case setup only once for control flow cases. 2016-04-28 15:16:20 -05:00
Niklas Hauser 06fc81f99d Add much better default handler declaration and usage. 2016-04-28 15:16:16 -05:00
Niklas Hauser 171033622b Move types and classes into seperate header files. Rename TestHarness to Harness. 2016-04-28 15:16:12 -05:00
Niklas Hauser 9f770f8ec8 This commits gets rid of all dependencies on unity.
Failures will not longjmp, but are reported on top of the stack,
by calling the case failure handler, which then decides whether to
continue or abort testing.

Other changes:

- Individual cases can have their own setup and teardown handlers,
- Case repeats are now handled by the case handler returning `control_flow_t`,
- Separates `status_t` and `failure_t`,
- Implements useful default case setup and teardown, and
- Keeps score of passes and failures on per case and test basis.
2016-04-28 15:16:04 -05:00