Created
March 5, 2018 14:31
-
-
Save ryanwilsonperkin/ea158f5d967cd55b06d7f88be41e0e2c to your computer and use it in GitHub Desktop.
Reads Xunit XML files and prints the (sorted) test names to stdout.
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/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