Looks good to me.  Provide a patch and new iutest plugin and I can test it 
also.


On Wed, 23 Oct 2002, James CE Johnson wrote:

> Jeffrey D. Brekke wrote:
> 
> >On Wed, 23 Oct 2002, James CE Johnson wrote:
> >
> >[SNIPPING]
> >
> >  
> >
> >>>We could use the currently defined iutest stuff, and
> >>>maybe you're idea of reusing the current test plugin implementation?
> >>>
> >>>      
> >>>
> >>I think that the implementation reuse is the most flexible. Granted, 
> >>they're all still assuming junit but at least you can parameterize them 
> >>for whatever "level" you might need.  I've already prototyped that here 
> >>for the prepare-filesystem, compile and test goals. That is, I created 
> >>tags testing:prepare-filesystem, testing:compile and testing:test.
> >>    
> >>
> >
> >Cool then.  If/when you get something together postit and we can take a 
> >look.  This sounds like it will server both our cases easily enough.
> >
> >  
> >
> 
> Here's what I have so far. It is still pretty new but preliminary 
> testing seems to indicate that it won't cause massive destruction....
> 
> It expects the plugin.properties for whatever plugin owns it to contain:
> iutest.src.path = src/iutest
> iutest.resources.includes =
> iutest.resources.excludes =
> iutest.build.dir = ${maven.build.dir}/iutest-classes
> iutest.report.dir = ${maven.build.dir}/iutest-reports
> 
> It doesn't support test resources but that would be an easy hack. We 
> don't use 'em here so I didn't spend the extra 10 minutes to do that bit.
> 
>   <!-- =========================================================== -->
>   <!-- Create tasks for testing things                             -->
> 
>   <goal name="com.imperitek:iutest-prepare-filesystem"
>         description="Create the needed directory structure for 
> integration testing">
>     <testing:prepare-filesystem test.dest="${iutest.build.dir}"
>                                 
> test.reportsDirectory="${iutest.report.dir}"/>
>   </goal>
> 
>   <goal name="com.imperitek:iutest-compile"
>         description="Compile the TestCases and TestSuites for 
> integration testing"
>         
> prereqs="java:compile,java:jar-resources,com.imperitek:iutest-prepare-filesystem">
>     <testing:compile test.dest="${iutest.build.dir}"
>                      test.src.path="${iutest.src.path}"
>                      test.resources.includes="${iutest.resources.includes}"
>                      test.resources.excludes="${iutest.resources.excludes}"
>                      />
>   </goal>
>  
>   <goal name="com.imperitek:iutest-test"
>         description="Integration test the application"
>         prereqs="com.imperitek:iutest-compile">
>     <testing:test test.junit.dir="${basedir}"
>                   test.dest="${iutest.build.dir}"
>                   test.src.path="${iutest.src.path}"
>                   test.reportsDirectory="${iutest.report.dir}"
>                   />
>   </goal>
>  
>   <goal name="com.imperitek:iutest-single"
>         description="Execute a single integration test defined using the 
> 'testcase' variable"
>         prereqs="com.imperitek:iutest-compile">
>     <testing:single test.junit.dir="${basedir}"
>                     test.dest="${iutest.build.dir}"
>                     test.reportsDirectory="${iutest.report.dir}"
>                     />
>   </goal>
>  
>   <define:taglib uri="testing">
> 
>     <define:tag name="prepare-filesystem">
>       <mkdir dir="${test.dest}"/>
>       <mkdir dir="${test.reportsDirectory}"/>
>     </define:tag> <!-- prepare-filesystem -->
> 
>     <define:tag name="compile">
>       <j:set var="maven.compile.debug" 
> value='${context.getVariable("maven.compile.debug")}'/>
>       <j:set var="maven.compile.deprecation" 
> value='${context.getVariable("maven.compile.deprecation")}'/>
>       <j:set var="maven.compile.optimize" 
> value='${context.getVariable("maven.compile.optimize")}'/>
>       <j:set var="maven.build.dest" 
> value='${context.getVariable("maven.build.dest")}'/>
>       <j:set var="maven.dependency.classpath" 
> value='${context.getVariable("maven.dependency.classpath")}'/>
>       <javac
>              destdir="${test.dest}"
>              excludes="**/package.html"
>              debug="${maven.compile.debug}"
>              deprecation="${maven.compile.deprecation}"
>              optimize="${maven.compile.optimize}">
>         <classpath>
>           <pathelement path="${maven.build.dest}"/>
>           <path refid="maven.dependency.classpath"/>
>           <pathelement path="${plugin.getDependencyPath('junit')}"/>
>         </classpath>
>         <src>
>           <path location="${test.src.path}"/>       
>         </src>
>       </javac>
>       <!--
>       Copies the resources needed by the tests
>       -->
>       <copy todir="${test.dest}">
>         <fileset dir="${test.src.path}">
>           <j:forEach var="res" items="${test.resources.includes}">
>             <include name="${res}"/>
>           </j:forEach>
>           <j:forEach var="res" items="${test.resources.excludes}">
>             <exclude name="${res}"/>
>           </j:forEach>
>         </fileset>
>       </copy>
>     </define:tag> <!-- compile -->
>    
>     <define:tag name="test">
>       <j:set var="maven.junit.fork" 
> value='${context.getVariable("maven.junit.fork")}'/>
>       <j:set var="maven.junit.sysproperties" 
> value='${context.getVariable("maven.junit.sysproperties")}'/>
>       <j:set var="maven.junit.usefile" 
> value='${context.getVariable("maven.junit.usefile")}'/>
>       <j:set var="maven.build.dest" 
> value='${context.getVariable("maven.build.dest")}'/>
>       <j:set var="maven.dependency.classpath" 
> value='${context.getVariable("maven.dependency.classpath")}'/>
>       <taskdef
>                name="junit"
>                
> classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"
>                />
>      
>       <junit printSummary="yes"
>              failureProperty="maven.test.failure"
>              fork="${maven.junit.fork}"
>              dir="${test.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>
>         <formatter type="xml"/>
>         <formatter type="plain" usefile="${maven.junit.usefile}"/>
>         <classpath>
>           <path refid="maven.dependency.classpath"/>
>           <pathelement location="${maven.build.dest}"/>
>           <pathelement location="${test.dest}"/>
>           <pathelement path="${plugin.getDependencyPath('junit')}"/>
>         </classpath>
>         <batchtest todir="${test.reportsDirectory}">
>           <fileset dir="${test.src.path}">
>             <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>
>           </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>
> 
>     </define:tag> <!-- test -->
> 
>     <define:tag name="single">
>      
>       <j:choose>
>         <j:when test="${empty(testcase)}">
>           <echo>
>             You must define the test case to run via -Dtestcase=classname
>             Example: maven -Dtestcase=MyTest test:single-test
>           </echo>
>         </j:when>
>        
>         <j:otherwise>
>          
>           <taskdef
>                    name="junit"
>                    
> classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"
>                    />
> 
>           <junit printSummary="yes"
>                  haltonfailure="yes"
>                  haltonerror="yes"
>                  fork="${maven.junit.fork}"
>                  dir="${test.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>
>             <formatter type="xml"/>
>             <formatter type="plain" usefile="false"/>
>             <formatter type="plain" usefile="true"/>
> 
>             <classpath>
>               <path refid="maven.dependency.classpath"/>
>               <pathelement location="${maven.build.dest}"/>
>               <pathelement location="${test.dest}"/>
>             </classpath>
> 
>             <test name="${testcase}" todir="${test.reportsDirectory}"/>
>            
>           </junit>
>          
>         </j:otherwise>
>       </j:choose>
> 
>     </define:tag> <!-- single -->
> 
>   </define:taglib> <!-- testing -->
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:turbine-maven-user-unsubscribe@;jakarta.apache.org>
> For additional commands, e-mail: <mailto:turbine-maven-user-help@;jakarta.apache.org>
> 

-- 
=====================================================================
Jeffrey D. Brekke                                   [EMAIL PROTECTED]
Software Engineer                                   [EMAIL PROTECTED]
Wisconsin,  USA                                     [EMAIL PROTECTED]



--
To unsubscribe, e-mail:   <mailto:turbine-maven-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:turbine-maven-user-help@;jakarta.apache.org>

Reply via email to