RIOT-OS / RobotFW-tests

Includes tests for RIOT based on the Robot Framework
GNU Lesser General Public License v2.1
4 stars 13 forks source link

Improve error messages #105

Closed MrKevinWeiss closed 3 years ago

MrKevinWeiss commented 3 years ago

This overrides the good old classics such as Resolving variable '${RESULT['result']}' failed or 'SUCCESS' does not contain 'FAIL' or who could forget the great 0 != 1 with a bit better messages that evaluate variables, print proper sentences, and explain what was expected s received.

A test to show some of these messages is also added to dist/tools/output_to_xunit and can be checked with make robot-clean robot-test.

EDIT: It turns out many other issues were discovered when working on this PR, so here it is.

Add a test to show failure messages without requiring hardware

Adding the 03__error_msg.robot test. To check one can simply use make -C dist/tools/output_to_xunit/ robot-clean robot-test.

Here we can see nice failure messages:

``` example.Error Msg :: Simple robot test that passes. ============================================================================== Should Mock Success | PASS | ------------------------------------------------------------------------------ Should Not Mock Success | FAIL | Mock Return Success expected FAIL but received Success ------------------------------------------------------------------------------ Should Not Mock Key Error | FAIL | Mock Key Error does not have a result, return = {'foo': 'Success'} ------------------------------------------------------------------------------ Should Not Mock Type Error | FAIL | Mock Type Error does not have a result, return = Success ------------------------------------------------------------------------------ Should API Call Repeat on Timeout Success | PASS | ------------------------------------------------------------------------------ Should API Call Repeat on Timeout Error | FAIL | Mock Return Timeout failed after 16 times with {'result': 'Timeout'} ------------------------------------------------------------------------------ example.Error Msg :: Simple robot test that passes. | FAIL | 6 tests, 2 passed, 4 failed ```

Better error messages/cleanup/fixes GPIO tests

Some non-common error messages are improved. Utilizing the Skip If keyword in Robot Framework V4, this also also refactoring some redundant functions.

Build system fixes

It turns out there are some issues with using error. The build system now uses FEATURE_REQUIRED and FEATURES_PROVIDED` to enforce proper wiring.

This is also useful for the CI to determine what builds actually fail and what should be failing/skipped

Scripting fixes

A small fix in the output_to_xunit/output_to_xunit.py script that prevents exceptions from being thrown if a benchmark test fails and doesn't contain an expected key.

MrKevinWeiss commented 3 years ago

It seems like there is still a reset problem but maybe outside the scope of this PR.

MrKevinWeiss commented 3 years ago

this PR has grown. The build system has been broken for a while it seems. Hopefully this will use FEATURES_REQUIRED so one can make clean without errors...

MrKevinWeiss commented 3 years ago

Though having build failed or skipped xunit generation would probably be better to include in the make system it is not trivial for me to figure out as we are using the FEATURES_* resolution in RIOT and I don't want to change riot. For the moment it can simply exist in the Jenkins job, this means that it will only get generated from the CI and reproducing locally is not automatic.

Since this is a fairly simple take to do manually maybe it is fine.

I will clean up this PR and maybe we can get it in since it contains fixes and cleanups that are needed for other ongoing work.

MrKevinWeiss commented 3 years ago

Jenkins

MrKevinWeiss commented 3 years ago

Results are looking as expected.

MrKevinWeiss commented 3 years ago

@leandrolanzieri can we merge?

MrKevinWeiss commented 3 years ago

Hmmm something is wrong with the logs...

MrKevinWeiss commented 3 years ago

This Shows spi (3.3) could not toggle to low, Check wiring vs this showing 1 != 0.

But I still have to look into why the logs are not being generated...

MrKevinWeiss commented 3 years ago

Hmmm I don't think the issue of the report is with PR but we should wait until it is figured out. ping @ozfox

MrKevinWeiss commented 3 years ago

Figured it out, it was just not rebasing the frontend. Here are the results.

We have PHiLIP.Write Reg expected Success but received Error and spi (3.2) could not toggle to low, Check wiring