开发者

What is the best way to filter errors/failures in JUnit files?

开发者 https://www.devze.com 2023-04-12 16:59 出处:网络
My division uses continuous integration but our product and process don\'t lend well to the model that bugs should be fixed immediately (long runtimes, shared resources, old VCS tools, etc). CI is sti

My division uses continuous integration but our product and process don't lend well to the model that bugs should be fixed immediately (long runtimes, shared resources, old VCS tools, etc). CI is still useful for detecting problems quickly and identifying the culprits though. I have a script which can read the JUnit XML file and determine which failures to filter and write a new filtered output file but I'd like to include information in the file which can be seen in CI tools which explains why it was filtered. Unfortunately, the testcase and testsuite elements seem to lack a node. Is there a place in the format where I can place this information?

<testsuites>
  <testsuite name="name">
    <testcase name="name">
开发者_开发问答      <failure>some message</failure>
    </testcase>
  </testsuite>
</testsuites>

Into something like:

<testsuites>
  <testsuite name="name">
    <testcase name="name">
      <failure>some message
Filtered: See bug #####</failure>
    </testcase>
  </testsuite>
</testsuites>


You can simply modify the test. If the current code is

Assert.fail("some message")

change it to

Assert.fail("some message\nFiltered: See bug #####")

You can add a message to assert... methods, too. Use

Assert.assertEquals("Filtered: See bug #####", expectedValue, actualValue)

instead of

Assert.assertEquals(expectedValue, actualValue)
0

精彩评论

暂无评论...
验证码 换一张
取 消