Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Concept] Add API for test case result handle #58

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions mbed_host_tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,35 @@ def abort(self):
finally:
self.finish()

def testcase_start(self, testcase_name):
"""! Notifies test case start
@param Test Case ID name
@detail This function notifies test environment abort test case execution start.
"""
print "{{testcase_start;%s}}"% testcase_name

def testcase_finish(self, testcase_name, success):
"""! Notifies test case finish. Return partial (test case) result from test suite
@param Test Case ID name
@param Success code, 0 - success, >0 failure reason, <0 inconclusive

@detail This function passes partial test suite's test case result to test
environment.
Each test suite (in many cases one binary with tests) can return
multiple partial results used to track test case results.

Test designers can use success code to return test case:
success == 0 - PASS, test case execution was successful.
success > 0 - FAILure, e.g. success == 404 can be used to
pass "Server not found".
success < 0 - Inconclusive test case execution, e.g.
"""
result = success
# If success is a bool we want to cast so success == True -> result == 0
if type(success) == bool:
result = int(not success)
print "{{testcase_finish;%s;%d}}"% (testcase_name, result)


def init_host_test_cli_params():
"""! Function creates CLI parser object and returns populated options object.
Expand Down