kyrus/python-junit-xml

The readme examples have several errors

Closed this issue · 0 comments

to_xml_string() example:

  1. Nothing is being passed to the to_xml_string() function
  2. Calling the function on the object "ts" instead of the TestSuite class. Errors if ts is already a list object.

Here is my version that works:
test_cases = [TestCase('Test1', 'some.class.name', 123.345, 'I am stdout!', 'I am stderr!')]
ts = [TestSuite("my test suite", test_cases)]
print(TestSuite.to_xml_string(ts))

to_file() example:

  1. Calling the function on the ts object. Should be on the class.
  2. function is "to_file()", not "write_to_file()" as listed.
  3. Might want to include f.close() just for those who may not know they need to close the file