maven-plugins/surefire/plugin.jelly
2004-01-09 16:22:58 +00:00

182 lines
5.7 KiB
XML

<?xml version="1.0"?>
<project xmlns:j="jelly:core"
xmlns:maven="jelly:maven"
xmlns:u="jelly:util"
xmlns:define="jelly:define">
<goal name="test"
description="Test the application"
prereqs="test:test"/>
<goal name="test:prepare-filesystem"
description="Create the needed directory structure">
<mkdir dir="${maven.test.dest}"/>
<mkdir dir="${maven.test.reportsDirectory}"/>
</goal>
<goal name="test:compile"
description="Compile the TestCases and TestSuites"
prereqs="java:compile,java:jar-resources,test:prepare-filesystem,test:test-resources">
<j:set var="maven.test.searchdir" value="${maven.test.dest}"/>
<j:if test="${context.getVariable('maven.test.search.classdir') == null}">
<j:set var="maven.test.searchdir" value="${pom.build.unitTestSourceDirectory}"/>
</j:if>
<j:if test="${unitTestSourcesPresent == 'true'}">
<javac
destdir="${maven.test.dest}"
excludes="**/package.html"
debug="${maven.compile.debug}"
deprecation="${maven.compile.deprecation}"
optimize="${maven.compile.optimize}">
<j:if test="${context.getVariable('maven.test.source') != null}">
<setProperty name="source" value="${maven.test.source}" />
</j:if>
<classpath>
<pathelement path="${maven.test.dest}"/>
<pathelement path="${maven.build.dest}"/>
<path refid="maven.dependency.classpath"/>
<pathelement path="${plugin.getDependencyPath('junit')}"/>
</classpath>
<src>
<path refid="maven.test.compile.src.set"/>
</src>
<j:if test="${context.getVariable('maven.compile.compilerargs') != null}">
<compilerarg line="${maven.compile.compilerargs}" />
</j:if>
<j:if test="${context.getVariable('maven.compile.encoding') != null}">
<setProperty name="encoding" value="${maven.compile.encoding}" />
</j:if>
<j:if test="${context.getVariable('maven.compile.executable') != null}">
<setProperty name="executable" value="${maven.compile.executable}" />
</j:if>
<j:if test="${context.getVariable('maven.compile.fork') != null}">
<setProperty name="fork" value="${maven.compile.fork}" />
</j:if>
<j:if test="${context.getVariable('maven.compile.source') != null}">
<setProperty name="source" value="${maven.compile.source}" />
</j:if>
<j:if test="${context.getVariable('maven.compile.verbose') != null}">
<setProperty name="verbose" value="${maven.compile.verbose}" />
</j:if>
</javac>
</j:if>
<j:if test="${!unitTestSourcesPresent}">
<echo>No test source files to compile.</echo>
</j:if>
</goal>
<goal name="test:test"
description="Test the application"
prereqs="test:compile">
<j:if test="${unitTestSourcesPresent == 'true' and context.getVariable('maven.test.skip') != 'true'}">
<j:useBean class="org.apache.maven.test.TestRunnerBooter" var="testRunner"/>
${testRunner.setProject(pom)}
${testRunner.execute()}
<j:set var="maven.test.failure" value="${testRunner.failures()}"/>
<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>
<j:if test="${!unitTestSourcesPresent}">
<echo>No tests to run.</echo>
</j:if>
</goal>
<goal name="test:single"
description="Execute a single test defined using the 'testcase' variable"
prereqs="test:compile">
<j:if test="${unitTestSourcesPresent == 'true'}">
</j:if>
<j:if test="${!unitTestSourcesPresent}">
<echo>No tests to run.</echo>
</j:if>
</goal>
<goal name="test:match"
description="Execute all the tests matching the given 'testmatch' variable"
prereqs="test:compile">
<j:if test="${unitTestSourcesPresent == 'true'}">
</j:if>
<j:if test="${!unitTestSourcesPresent}">
<echo>No tests to run.</echo>
</j:if>
</goal>
<goal name="test:single-test"
description="[deprecated] please use the test:single goal instead">
<echo>[deprecated] please use the test:single goal instead</echo>
<attainGoal name="test:single"/>
</goal>
<goal name="test:match-test"
description="[deprecated] please use the test:match goal instead">
<echo>[deprecated] please use the test:match goal instead</echo>
<attainGoal name="test:match"/>
</goal>
<goal name="test:eclipse">
<echo>Used by eclipse to drag in test plugin context</echo>
</goal>
<!-- ================================================================== -->
<!-- T E S T R E S O U R C E S -->
<!-- ================================================================== -->
<goal name="test:test-resources"
description="Copy any resources that must be present for run tests"
prereqs="test:prepare-filesystem">
<j:if test="${unitTestSourcesPresent}">
<j:if test="${pom.build.unitTest != null}">
<j:if test="${!pom.build.unitTest.resources.isEmpty()}">
<maven:copy-resources
resources="${pom.build.unitTest.resources}"
todir="${maven.test.dest}"
/>
</j:if>
</j:if>
</j:if>
</goal>
<define:taglib uri="test">
<define:tag name="dependency-handle">
<!-- XXX Use this tag to allow this plugin to be loaded into another -->
</define:tag>
</define:taglib>
</project>