Version 9

    We use the ant-task to execute tests. That task uses the concept of formatters.

     

    The actual implementation uses the XML formater by specifying type="xml" in the formatter attribute.

     

    If we need to execute the same test more than once, using this default formatter will always overwrite the results.

     

    For keeping these results alive, we have created another formatter. So, use these steps to keep JUnit results between different runnings:

     

     

    1. Define the sysproperty "jboss-junit-configuration" during the junit calling. (Do not use any funny HTTP character like gt lt & = ; )

    2. Change the formatter and set a different extension for keeping the files between different executions:

    Set the class by classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter"

     

    Here is a complete example of the changes:

     

          <junit dir="${module.output}"
             printsummary="${junit.printsummary}"
             haltonerror="${junit.haltonerror}"
             haltonfailure="${junit.haltonfailure}"
             fork="${junit.fork}"
             timeout="${junit.timeout}"
             jvm="${junit.jvm}"
             failureProperty="tests.failure">
              .... 
          <sysproperty key="jboss-junit-configuration" value="${jboss-junit-configuration}"></sysproperty>
             <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter" usefile="${junit.formatter.usefile}" extension="-${jboss-junit-configuration}.xml" ></formatter>
             .....
         </junit>
    
    

     

    • NOTE: The system property (not the extension) is what is used to distinguish the tests.

    • NOTE 2: Do not specify type="xml" otherwise it will use the standard xml formatter. The classname will be ignored.