Added cactus:match goal. Need to refactor catus:test/match/single goals to reuse code.

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113638 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
epugh
2003-07-10 15:58:11 +00:00
parent 21e3ac3be9
commit e8c1edec5d
4 changed files with 154 additions and 15 deletions

View File

@@ -6,6 +6,12 @@
Cactus project.
=============================================================================
-->
<!--
Note: There is significant refactoring required for the goals cactus:test,
cactus:single, and cactus:match. The <cactus> tasks in each of those goals
are mostly similar.
-->
<project
xmlns:j="jelly:core"
xmlns:doc="doc"
@@ -348,22 +354,26 @@
</goal>
<!--
========================================================================
Execute a single Cactus test on all containers which have been defined,
i.e. which have a ${cactus.home.[container name]} property
defined. Specify the case with -Dcactus.testcase=my.test.Case
========================================================================
<!--
========================================================================
Execute a single Cactus test on all containers which have been defined,
i.e. which have a ${cactus.home.[container name]} property
defined. Specify the case with -Dtestcase=my.single.TestCase
========================================================================
-->
<goal name="cactus:single" prereqs="cactus:init,cactus:cactifywar"
description="Run a single Cactus Test Case">
<j:set var="testcase__" value="${testcase}X"/>
<j:if test="${testcase__ == 'X'}">
<ant:fail>You must provide a test case using -Dtestcase=my.single.TestCase</ant:fail>
</j:if>
<cactus warfile="${maven.build.dir}/${pom.artifactId}-cactus.war"
<j:choose>
<j:when test="${empty(testcase)}">
<echo>
You must define the test case to run via -Dtestcase=classname
Example: maven -Dtestcase=MyTest cactus:single
</echo>
</j:when>
<j:otherwise>
<cactus warfile="${maven.build.dir}/${pom.artifactId}-cactus.war"
fork="yes" errorproperty="cactustests.error"
failureproperty="cactustests.failure"
printsummary="${maven.cactus.printsummary}">
@@ -439,9 +449,116 @@
<ant:formatter type="xml"/>
<!-- Run only a single testcase passed in via -Dtestcase=my.single.TestCase-->
<ant:test name="${testcase}"/>
</cactus>
</cactus>
</j:otherwise>
</j:choose>
</goal>
<!--
========================================================================
Execute a Cactus tests on all containers which have been defined,
i.e. which have a ${cactus.home.[container name]} property
defined. Specify the matching tests with -Dmatch=FooTest
========================================================================
-->
<goal name="cactus:match" prereqs="cactus:init,cactus:cactifywar"
description="Execute all the Cactus tests matching the given 'testmatch' variable">
<j:choose>
<j:when test="${empty(testmatch)}">
<echo>
You must define the test case to match via -Dtestmatch=classname
Example: maven -Dtestmatch=MyTest cactus:match
</echo>
</j:when>
<j:otherwise>
<cactus warfile="${maven.build.dir}/${pom.artifactId}-cactus.war"
fork="yes" errorproperty="cactustests.error"
failureproperty="cactustests.failure"
printsummary="${maven.cactus.printsummary}">
<ant:classpath>
<ant:pathelement path="${maven.build.dest}"/>
<ant:pathelement location="${cactus.target.classes.dir}"/>
<ant:path refid="maven.dependency.classpath"/>
<ant:path refid="cactus.classpath"/>
</ant:classpath>
<containerset>
<!-- TODO: Find how to set the port for JBoss 3x -->
<jboss3x if="cactus.home.jboss3x"
dir="${cactus.home.jboss3x}"
output="${cactus.reports.dir}/jboss3x.out"
todir="${cactus.reports.dir}/jboss3x"
config="${cactus.jboss3x.config.name}"/>
<orion1x if="cactus.home.orion1x"
dir="${cactus.home.orion1x}" port="${cactus.port}"
output="${cactus.reports.dir}/orion1x.out"
todir="${cactus.reports.dir}/orion1x"/>
<orion2x if="cactus.home.orion2x"
dir="${cactus.home.orion2x}" port="${cactus.port}"
output="${cactus.reports.dir}/orion2x.out"
todir="${cactus.reports.dir}/orion2x"/>
<resin2x if="cactus.home.resin2x"
dir="${cactus.home.resin2x}" port="${cactus.port}"
output="${cactus.reports.dir}/resin2x.out"
todir="${cactus.reports.dir}/resin2x">
<j:if test="${context.getVariable('cactus.resin2x.config') != null}">
<ant:setProperty name="resinconf" value="${cactus.resin2x.config}"/>
</j:if>
</resin2x>
<tomcat4x if="cactus.home.tomcat4x"
dir="${cactus.home.tomcat4x}" port="${cactus.port}"
output="${cactus.reports.dir}/tomcat4x.out"
todir="${cactus.reports.dir}/tomcat4x">
<j:if test="${context.getVariable('cactus.tomcat4x.config') != null}">
<ant:setProperty name="serverxml" value="${cactus.tomcat4x.config}"/>
</j:if>
<j:if test="${context.getVariable('cactus.tomcat4x.tmpdir') != null}">
<ant:setProperty name="tmpdir" value="${cactus.tomcat4x.tmpdir}"/>
</j:if>
<j:if test="${context.getVariable('cactus.tomcat4x.conf.dir') != null}">
<conf dir="${cactus.tomcat4x.conf.dir}"
includes="${cactus.tomcat4x.conf.includes}"
excludes="${cactus.tomcat4x.conf.excludes}"/>
</j:if>
</tomcat4x>
<tomcat5x if="cactus.home.tomcat5x"
dir="${cactus.home.tomcat5x}" port="${cactus.port}"
output="${cactus.reports.dir}/tomcat5x.out"
todir="${cactus.reports.dir}/tomcat5x">
<j:if test="${context.getVariable('cactus.tomcat5x.config') != null}">
<ant:setProperty name="serverxml" value="${cactus.tomcat5x.config}"/>
</j:if>
<j:if test="${context.getVariable('cactus.tomcat5x.tmpdir') != null}">
<ant:setProperty name="tmpdir" value="${cactus.tomcat5x.tmpdir}"/>
</j:if>
<j:if test="${context.getVariable('cactus.tomcat5x.conf.dir') != null}">
<conf dir="${cactus.tomcat5x.conf.dir}"
includes="${cactus.tomcat5x.conf.includes}"
excludes="${cactus.tomcat5x.conf.excludes}"/>
</j:if>
</tomcat5x>
</containerset>
<ant:formatter type="plain" usefile="${cactus.junit.usefile}"/>
<ant:formatter type="xml"/>
<!-- Run all testcases matched via -Dtestmatch=FooTest-->
<ant:batchtest>
<ant:fileset dir="${cactus.src.dir}">
<include name="**/${testmatch}.java"/>
</ant:fileset>
</ant:batchtest>
</cactus>
</j:otherwise>
</j:choose>
</goal>
<!--
========================================================================
Register a Cactus report.

View File

@@ -7,7 +7,12 @@
<body>
<release version="3.0" date="in CVS">
<release version="3.0" date="in CVS">
<action dev="epugh" type="add">
New goal cactus:match added that allows you to run just matching testcases.
Pass the testcase in using -Dtestmatch=MyTestCase. This brings to parity the
cactus plugin with the test plugin for running types of tests.
</action>
<action dev="epugh" type="add">
New goal cactus:single added that allows you to run just a single testcase.
Pass the testcase in using -Dtestcase=my.single.TestCase.

View File

@@ -35,7 +35,15 @@
a <code>cactus.home.[container name]</code> property. Pass the name
of the testcase in using -Dtestcase=my.single.TestCase.
</description>
</goal>
</goal>
<goal>
<name>cactus:match</name>
<description>
Run all Cactus tests that match a property <code>-Dtestmatch=MyTestCase</code>
on the containers for which you have defined
a <code>cactus.home.[container name]</code> property.
</description>
</goal>
<goal>
<name>cactus:report</name>
<description>

View File

@@ -13,6 +13,15 @@
</p>
<subsection name="3.1">
<p>
<ul>
<li>
Refactor code in goals cactus:test, cactus:single, and cactus:match
to share more code. Currently there is a lot of cut-n-paste code.
Should use jelly tags to reuse code.
</li>
</ul>
</p>
<p>
<ul>
<li>