Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Reads Xunit XML files and prints the (sorted) test names to stdout.
#!/usr/local/bin/python
"""
Reads Xunit XML files and prints the (sorted) test names to stdout.
usage: python create_test_list.py file [file...]
"""
import sys
import xml.etree.ElementTree as ET
def xmlToList(filename):
tree = ET.parse(filename)
root = tree.getroot()
return [
'{classname}:{name}'.format(**child.attrib)
for child in root
]
if __name__ == "__main__":
filenames = sys.argv[1:]
test_list = []
for filename in filenames:
test_list.extend(xmlToList(filename))
test_list.sort()
for test in test_list:
sys.stdout.write(test + '\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.