Last active
April 12, 2017 14:00
-
-
Save demelev/3c66087bcc34e10a9caa580555ba7709 to your computer and use it in GitHub Desktop.
Filter for unity3d Test Results xml file. `fancy_unity_tests_results.py EditorTestResults.xml`
This file contains hidden or 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
#!/usr/bin/env python3 | |
import xml.etree.ElementTree as etree | |
import sys; | |
tree = etree.parse(sys.argv[1]) | |
root = tree.getroot() | |
els = tree.findall(".//test-case[@result='Failed']") | |
def print_test_name(name): | |
print("\t\033[91m"+name) | |
def print_blue_bg(text): | |
print("\033[44m%s\033[0m" % text) | |
def print_reason(text): | |
print("\t" + text) | |
print("") | |
if len(els) == 0: | |
print("\033[92mAll tests are passed.") | |
else: | |
print("\033[91mThere are %s failed tests:\n" % len(els)) | |
for e in els: | |
print_test_name(e.get('name')) | |
reason = e.find("reason") | |
if reason: | |
print_blue_bg("Reason") | |
message = reason.find("message") | |
print_reason(message.text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment