title: Add failing test to JUnit XML using junit-xml python module
body: <p>I have some old C/Fortran code and I'm integrating it into bamboo. The code comes with a whole bunch of tests, but the end result is that if a test &quot;fails&quot; some details are printed, otherwise it is silent. The results are compiled into a file that looks like this:</p>
  <pre><code>TEST_NAME,OUT,ERR
  tname0,,
  tname1,,
  tname2,,2c3ef0 
  </code></pre>
  <p>So in the above example, tname0 and tname1 passed, but tname2 failed. What this means for the file is that the first column always has data, the second column never has data, and the third column only has data if a test fails.</p>
  <p>I'm using the junit-xml python module to write the test results to xml so that Bamboo's JUnit parser can read it. However, I can't figure out how to add a failing TestCase and the junit-xml documentation doesn't seem to have any examples: <a href="https://github.com/kyrus/python-junit-xml" rel="nofollow noreferrer">https://github.com/kyrus/python-junit-xml</a></p>
  <p>This is the gist of my parser:</p>
  <pre class="lang-python prettyprint-override"><code>from junit_xml import TestSuite, TestCase
  import os
  
  def main(fname, testname=&quot;DEFAULT&quot;):
  
      test_cases = []
      testIdx = 0
  
      with open(fname, 'r') as fid:
          for line in fid.readlines():
              testIdx += 1
              line = line.split(&quot;,&quot;)
  
              test_cases.append((TestCase(&quot;Test&quot; + str(testIdx), line[0],0,line[1], line[2]))
  
      ts = TestSuite(testname, test_cases)
      xmlstr = TestSuite.to_xml_string([ts])
  
      # Bamboo's default is to look for JUnit XML in directories named &quot;**/test-reports/&quot;
      ofile = os.path.join(&quot;test-reports&quot;, &quot;test_&quot; + testname + &quot;.xml&quot;)
  
      with open(ofile, &quot;w&quot;) as ofid:
          ofid.write(xmlstr)
  
  </code></pre>
  <p>Unfortunately, it never seems to detect failing tests. It definitely puts the error messages into <code>&lt;system-err&gt;</code> tags, but it never seems to actually detect any errors and the top of the xml file always looks something like this:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; ?&gt;
  &lt;testsuites disabled=&quot;0&quot; errors=&quot;0&quot; failures=&quot;0&quot; tests=&quot;42&quot; time=&quot;0.0&quot;&gt;
      &lt;testsuite disabled=&quot;0&quot; errors=&quot;0&quot; failures=&quot;0&quot; name=&quot;DEFAULT&quot; skipped=&quot;0&quot; tests=&quot;42&quot; time=&quot;0&quot;&gt;
  </code></pre>
  <p>Is there something I'm missing and/or some more thorough documentation out there? Even if I brute-force it and just count up the errors and do a find-replace in the xml string to write <code>errors=&quot;1&quot;</code> or something, Bamboo won't pick them up as failed tests, so I feel like there must be something more subtle going on.</p>