I'm not claiming it's pretty, but it works for me.  Most of
it is coppied from various plugins.  Assuming that your
integration tests are long running Junit tests.

Add this to your project's maven.xml file.


   <preGoal name="test:compile">
                <javac 
                    verbose="no"
                destdir="${maven.build.dir}/test-classes"
                excludes="**/package.html"
            debug="${maven.compile.debug}"
                deprecation="${maven.compile.deprecation}"
                optimize="${maven.compile.optimize}"
           
srcdir="${pom.build.integrationUnitTestSourceDirectory}">
                <classpath>
                  <pathelement path="${maven.build.dest}"/>
              <path refid="maven.dependency.classpath"/>
                  <pathelement
path="${plugin.getDependencyPath('junit')}"/>
                </classpath>
         </javac>
   </preGoal>
 
   <preGoal name="clover:on">
       <j:set 
       var="jon.clover.running"
       value="yes"/>
   </preGoal>
   
   <postGoal name="clover:html-report">
      <j:set
      var="jon.clover.running"
       value=""/>
   </postGoal>
   <postGoal name="test:test">
      <j:if test="${jon.clover.running}">
         
              <taskdef
        name="junit"
       
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"
      />
      
      <junit printSummary="yes" 
             failureProperty="maven.test.failure"
             fork="${maven.junit.fork}"
             dir="${maven.junit.dir}">
        <sysproperty key="basedir" value="${basedir}"/>
        <u:tokenize var="listOfProperties" delim="
">${maven.junit.sysproperties}</u:tokenize>
        <j:forEach var="someProperty"
items="${listOfProperties}">
          <sysproperty key="${someProperty}"
value="${context.findVariable(someProperty)}"/>
        </j:forEach>
        <u:tokenize var="listOfJvmArgs" delim="
">${maven.junit.jvmargs}</u:tokenize>
        <j:forEach var="somejvmarg"
items="${listOfJvmArgs}">
          <jvmarg value="${somejvmarg}"/>
        </j:forEach>
        <formatter type="xml"/>
        <formatter type="plain"
usefile="${maven.junit.usefile}"/>
        <classpath>
          <path refid="maven.dependency.classpath"/>
          <pathelement
location="${maven.build.dir}/clover/classes"/>
          <pathelement
location="${maven.build.dir}/test-classes"/>
          <pathelement
path="${plugin.getDependencyPath('junit')}"/>
        </classpath>
        <batchtest todir="${maven.build.dir}/test-reports">
          <fileset
dir="${pom.build.integrationUnitTestSourceDirectory}">
            <j:forEach var="pat"
items="${pom.build.unitTest.includes}">
              <include name="${pat}"/>
            </j:forEach>
            <j:forEach var="pat"
items="${pom.build.unitTest.excludes}">
              <exclude name="${pat}"/>
            </j:forEach>
              <exclude name="**/*AbstractTestCase.java"/>
          </fileset>
        </batchtest>
      </junit>

      <j:if test="${maven.test.failure}">
        <j:set var="ignore__"
value="${maven.test.failure.ignore}X"/>
        <j:if test="${ignore__ == 'X'}">
          <fail message="There were test failures."/>
        </j:if>
      </j:if>
      </j:if>
   </postGoal>

-- 



Headline: "Coal Miners Refuse To Work After Death." 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to