Skip to content

Instantly share code, notes, and snippets.

@demelev
Last active April 12, 2017 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save demelev/3c66087bcc34e10a9caa580555ba7709 to your computer and use it in GitHub Desktop.
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`
#!/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