Skip to content

Instantly share code, notes, and snippets.

@SeppoTakalo
Last active September 25, 2018 10:05
Show Gist options
  • Save SeppoTakalo/718fdfd7ecc30723aad4ac0e7dd739a2 to your computer and use it in GitHub Desktop.
Save SeppoTakalo/718fdfd7ecc30723aad4ac0e7dd739a2 to your computer and use it in GitHub Desktop.
Running Greentea tests manually

Running Greentea testcase manually

As you all know, Greentea test binaries contain whole testcase and rarely needs anything from external systems.

All external tools and commands like mbed test, htrun and mbedgt are just used to start this test binary and to parse result from serial port.

However, most of the testcases do not require any communication from host, and you are therefore capable of running those tests manually.

To do so:

  1. Build the test binary with mbed test --compile
  2. Flash the test binary to board
  3. Open serial terminal
  4. Copy&paste following string: {{__sync;1}}

Example of test run

Output of running Mbed OS WiFi test manually looks like this:

mbedmbedmbedmbedmbedmbedmbedmbed
{{__sync;1}}
{{__version;1.3.0}}
{{__timeout;240}}
{{__host_test_name;default_auto}}
>>> Running 16 test cases...
                            {{__testcase_name;WIFI-CONSTRUCTOR}}
{{__testcase_name;WIFI-CONNECT-NOCREDENTIALS}}
{{__testcase_name;WIFI-SET-CREDENTIAL}}
{{__testcase_name;WIFI-SET-CHANNEL}}
{{__testcase_name;WIFI-GET-RSSI}}
{{__testcase_name;WIFI-CONNECT-PARAMS-NULL}}
{{__testcase_name;WIFI-CONNECT-PARAMS-VALID-UNSECURE}}
{{__testcase_name;WIFI-CONNECT-PARAMS-VALID-SECURE}}
{{__testcase_name;WIFI-CONNECT-PARAMS-CHANNEL}}
{{__testcase_name;WIFI-CONNECT-PARAMS-CHANNEL-FAIL}}
{{__testcase_name;WIFI-CONNECT}}
{{__testcase_name;WIFI-CONNECT-SECURE}}
{{__testcase_name;WIFI-CONNECT-SECURE-FAIL}}
{{__testcase_name;WIFI-CONNECT-DISCONNECT-REPEAT}}
{{__testcase_name;WIFI-SCAN-NULL}}
{{__testcase_name;WIFI-SCAN}}

>>> Running case #1: 'WIFI-CONSTRUCTOR'...
                                          {{__testcase_start;WIFI-CONSTRUCTOR}}
...
{{__testcase_finish;WIFI-SET-CREDENTIAL;1;0}}
>>> 'WIFI-SET-CREDENTIAL': 1 passed, 0 failed
...

As you can see, it is very much human readable format, so you can use this method to run & debug without using command line tools to start the testcase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment