Niklas Hauser
01040bb9bf
Do not report failure with uninitialized harness.
...
Calling `raise_failure` before harness is initialized can print
unintentional failure strings.
This disallows using Unity macros outside of the utest harness.
2016-04-28 15:19:44 -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
5a052a523a
Fixed premature validation attribute modification.
2016-04-28 15:19:25 -05:00
Niklas Hauser
7f9f0d81ab
Allow case attribute modification in callback validation.
2016-04-28 15:19:21 -05:00
Niklas Hauser
d5c8b80e73
Replace `repeat_count` with `call_count`.
...
This aims to reduce confusion over repeat vs. call counting, and
the resulting off-by-one error due to different user expectations.
2016-04-28 15:19:13 -05:00
Niklas Hauser
ea2befaeee
Test: Fix control_t behavior and assert with test.
2016-04-28 15:19:01 -05:00
Niklas Hauser
d2093f1ddc
Types: Add type-compatible Timeout factory functions. Add CaseAwait behavior for infinite timeouts. Improve enum naming.
2016-04-28 15:18:57 -05:00
Niklas Hauser
34571488a6
Harness: Fix case index counting.
2016-04-28 15:18:49 -05:00
Niklas Hauser
17c89289a1
Harness: Fix bugs in repeat logic.
2016-04-28 15:18:45 -05:00
Niklas Hauser
205233a6db
Repeat: Allow repeat on timeout and validation at the same time.
2016-04-28 15:18:41 -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
dc242ee280
Harness: Atomic execution of handlers not necessary.
2016-04-28 15:18:20 -05:00
Niklas Hauser
0b93efe7f6
Return whether the specification can be run or not. Do not die after specification teardown handler.
2016-04-28 15:18:16 -05:00
Niklas Hauser
4e5996ceea
Allow starting a specification at a different case.
...
This can be used to skip failing test cases with external support from
a test runner like greentea.
It would reset the device and execute the specification again, but start
at the next test case.
2016-04-28 15:18:12 -05:00
Niklas Hauser
c2343b223b
Update namespace from v0 to v1.
2016-04-28 15:18:08 -05:00
Niklas Hauser
d59284850d
Fix off-by-one error in case indexing.
2016-04-28 15:18:03 -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
a83e54c915
Types: Use largest value in timeout as inactive hint.
...
This allows arbitrating to the more restrictive timeout.
2016-04-28 15:17:38 -05:00
Niklas Hauser
dc4cb4585c
Unify `Case` and `AsyncCase` using return type.
...
By letting the test case return a `control_t` type, it can decide itself
if it repeats, and what timeouts are required.
This removes the `AsyncCase` and allows a uniform declaration of test
cases.
2016-04-28 15:17:34 -05:00
Niklas Hauser
b72f18009b
Harness: Remove `.tolerance(0)` as not required.
2016-04-28 15:17:29 -05:00
Niklas Hauser
b119cb2280
Case: `timeout_ms` is unsigned, use 0 as do-not-use indicator.
2016-04-28 15:17:18 -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
9c32e01d52
Harness: Add `is_busy()` method.
2016-04-28 15:17:09 -05:00
Niklas Hauser
e77743d6a6
Types: Add repeat count to `control_flow_handler_t`.
2016-04-28 15:17:05 -05:00
Niklas Hauser
2cf2ef5415
Move default handlers into specification.
2016-04-28 15:16:51 -05:00
Niklas Hauser
9a4e0d2da8
Add Specification class with common setup and teardown handlers.
2016-04-28 15:16:47 -05:00
Niklas Hauser
e2a5d97f77
Harness: Add empty test case detection.
2016-04-28 15:16:44 -05:00
Niklas Hauser
2bbf725bcc
Harness: Make it interrupt safe.
...
We do not want to have a call to `validate_callback()` before
`run_next_case()` is finished or while `handle_timeout()` is executing.
2016-04-28 15:16:40 -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
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