-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added --report-junit to options. So CI can be enriched with Junit res…
…ults and plots
- Loading branch information
1 parent
75a4cf7
commit 8d7a14f
Showing
2 changed files
with
80 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
""" | ||
mbed SDK | ||
Copyright (c) 2011-2015 ARM Limited | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
Author: Przemyslaw Wirkus <[email protected]> | ||
""" | ||
|
||
from junit_xml import TestSuite, TestCase | ||
|
||
|
||
def exporter_junit(test_result_ext, test_suite_properties=None): | ||
""" Export test results in JUnit XML compliant format | ||
""" | ||
test_suites = [] | ||
test_cases = [] | ||
|
||
targets = sorted(test_result_ext.keys()) | ||
for target in targets: | ||
test_cases = [] | ||
tests = sorted(test_result_ext[target].keys()) | ||
for test in tests: | ||
test_results = test_result_ext[target][test] | ||
classname = 'test.%s.%s' % (target, test) | ||
elapsed_sec = test_results['elapsed_time'] | ||
_stdout = test_results['single_test_output'] | ||
_stderr = '' | ||
# Test case | ||
tc = TestCase(test, classname, elapsed_sec, _stdout, _stderr) | ||
# Test case extra failure / error info | ||
if test_results['single_test_result'] == 'FAIL': | ||
message = test_results['single_test_result'] | ||
tc.add_failure_info(message, _stdout) | ||
elif test_results['single_test_result'] != 'OK': | ||
message = test_results['single_test_result'] | ||
tc.add_error_info(message, _stdout) | ||
|
||
test_cases.append(tc) | ||
ts = TestSuite("test.suite.%s" % target, test_cases) | ||
test_suites.append(ts) | ||
return TestSuite.to_xml_string(test_suites) |