Open ktkopone opened 6 years ago
Yeah, we've been thinking about this. It seems reasonable to propagate Junit's assertion errors as Mobly's assert errors. This would require changes on both snippet client and server sides though.
We can give this a try in Mobly 1.9
Sorry this has been pushed back a lot. Because the scope needed to enable this is bigger than expected.
We are considering creating a generic mechanism to propagate errors from snippet server to client side. To make this non-trivial change to snippet lib, we need to first clean up some legacy issues, including the divergence in the implementation of snippet lib for various platforms.
This may just be a question of me not being able to find it in the docs/examples, but: In our use case we run the bulk of our testing in snippet RPC calls to the device, with java/JUnit assertions being raised within those calls. However, when an assertion fails in the RPC calls, an ApiError is instead propagated up to the python test (seemingly due to the RPC call crashing), and the test thus shows an 'error' rather than a fail. The same holds true for regular java AssertionError.
Since ApiError is propagated up, it isn't ~possible~ easy to use python-side code to distinguish proper test fails from errors, and the test summary will show 'errors' where 'fails' would be more desirable.
It would be nice if there were at least an arg option to make java/junit assertion fails get caught and propagated up through the rpc call into mobly's fail exception type or an assertionerror. This could similarly be done for junit skips.
Sample stacktrace: