XML : extending the data inside of the XML result file for unit tests

We use ANT to build our product. During this process jUnit tests are executed. This results in an xml file containing the outcome of each unit test.

We would like to enrich the xml file with the annotations that we placed in the test class.

as an example:

SomeTest.java file contains:

  @Requirement("UC685")  public class ClassToUseAsTest extends AbstractTestCase {      protected void setUp() throws Exception {      try {        ... // Not important      } catch (Exception e) {        ...      }    }      @Requirement("UC686")    public void testSomething() throws Exception {      ... // some code here      assertTrue(...);    }  }    

for the above jUnit test class the following xml part is created:

  ...  <testsuite errors="0" failures="0" hostname="blabla" id="778" name="ClassToUseAsTest " package="this.is.some.package" skipped="0" tests="1" time="0.078" timestamp="2015-12-22T11:36:28">  <properties>  </properties>    <testcase classname="this.is.some.package.ClassToUseAsTest " name="testSomething" time="0.016" />    <system-out />    <system-err />    </testsuite>  ...    

What we would like to see is that the values of the annotation appear in the testsuite and testcase resp. Either as a node itself or as one of the values of a node.

Is this possible?

It is not a requirement to use annotations for this. If it can be done in another way then that's ok.

Do we need to build a "plugin" for that? What would be a good place to start for that? Is it possible to build plug ins for jUnit?

Regards.

No comments:

Post a Comment