Skip to content

Commit 4a0bb5b

Browse files
committed
Update utest README
1 parent 1a9df42 commit 4a0bb5b

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

features/frameworks/utest/README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@ The order of handler execution is:
2525

2626
## Example
2727

28-
The following example showcases a lot of functionality and proper integration with the [Greentea testing automation framework](https://github.com/ARMmbed/greentea), while making use of the [unity test macros](https://github.com/ARMmbed/mbed-os/tree/master/features/frameworks/unity):
28+
The following example showcases a lot of functionality and proper integration with the [Greentea test tool](https://github.com/ARMmbed/mbed-os-tools/tree/master/packages/mbed-greentea), while making use of the [unity test macros](https://github.com/ARMmbed/mbed-os/tree/master/features/frameworks/unity):
2929

3030
```cpp
31-
#include "mbed-drivers/test_env.h"
31+
#include "mbed.h"
32+
#include "greentea-client/test_env.h"
3233
#include "utest/utest.h"
3334
#include "unity/unity.h"
3435

@@ -45,6 +46,7 @@ status_t test_repeats_setup(const Case *const source, const size_t index_of_case
4546
printf("Setting up for '%s'\n", source->get_description());
4647
return status;
4748
}
49+
4850
control_t test_repeats(const size_t call_count) {
4951
printf("Called for the %u. time\n", call_count);
5052
TEST_ASSERT_NOT_EQUAL(3, call_count);
@@ -58,10 +60,12 @@ void test_callback_validate() {
5860
// Validate the callback
5961
Harness::validate_callback();
6062
}
63+
6164
control_t test_asynchronous() {
6265
TEST_ASSERT_TRUE_MESSAGE(true, "(true == false) o_O");
6366
// Set up a callback in the future. This may also be an interrupt!
64-
minar::Scheduler::postCallback(test_callback_validate).delay(minar::milliseconds(100));
67+
EventQueue *queue = mbed_event_queue();
68+
queue->call_in(100, test_callback_validate);
6569
// Set a 200ms timeout starting from now
6670
return CaseTimeout(200);
6771
}
@@ -72,7 +76,8 @@ control_t test_asynchronous_timeout(const size_t call_count) {
7276
// but automatically repeat only this handler on timeout.
7377
if (call_count >= 5) {
7478
// but after the 5th call, the callback finally gets validated
75-
minar::Scheduler::postCallback(test_callback_validate).delay(minar::milliseconds(100));
79+
EventQueue *queue = mbed_event_queue();
80+
queue->call_in(100, test_callback_validate);
7681
}
7782
return CaseRepeatHandlerOnTimeout(200);
7883
}
@@ -95,7 +100,7 @@ Case cases[] = {
95100
// Declare your test specification with a custom setup handler
96101
Specification specification(greentea_setup, cases);
97102

98-
void app_start(int, char**)
103+
int main()
99104
{ // Run the test specification
100105
Harness::run(specification);
101106
}
@@ -155,7 +160,7 @@ Please see the `utest/types.h` file for a detailed description.
155160
1. `status_t case_teardown_handler_t(const Case *const source, const size_t passed, const size_t failed, const failure_t reason)`: called after execution of each test case, and if testing is aborted.
156161
1. `status_t case_failure_handler_t(const Case *const source, const failure_t reason)`: called whenever a failure occurs during the execution of a test case.
157162

158-
All handlers are defaulted for integration with the [Greentea testing automation framework](https://github.com/ARMmbed/greentea).
163+
All handlers are defaulted for integration with the [Greentea testing tool](https://github.com/ARMmbed/mbed-os-tools/tree/master/packages/mbed-greentea).
159164

160165
### Test Case Handlers
161166

@@ -416,4 +421,4 @@ void main() // or whatever your custom entry point is
416421
}
417422
}
418423
}
419-
```
424+
```

0 commit comments

Comments
 (0)