Available to Ant, you must have
Setup your build file with the task
<taskdef name="generate-test-overview" classname="bad.robot.concordion.ant.GenerateTestOverviewTask"/>
(having first copied concordion-ant-task-1.0.jar into $ANT_HOME/lib or reference it in the taskdef above by some other Ant mechanism)
then generate your overview page during your build using a target similar to below
<target name="generate-overview"> <generate-test-overview template="Overview.ftl" output="Overview.html"> <fileset dir="/Users/toby/Workspace/bad.robot/concordion-ant-task"> <include name="**/*.html"/> <exclude name="**/Overview.html" /> </fileset> </generate-test-overview> </target>
all that's left is to run your newly generated overview page as a Concordion test. Ensure that you have a
corresponding Java fixture on the classpath (annotated with @RunWith(ConcordionRunner.class)
), then..
<target name="run.acceptance.tests" depends="generate-overview"> <junit printsummary="yes" haltonfailure="yes"> <formatter type="plain"/> <test name="Overview"/> <!-- corresponding java fixture, must match the overview page generated --> </junit> </target>
If you already have a Maven based build, you can still hook into Ant to call the task. Using a build.xml
based on the example above, update your pom
with the following
... <plugin> <artifactId>maven-antrun-plugin</artifactId> <version>1.4</version> <executions> <execution> <phase>test</phase> <configuration> <tasks> <property name="classpath" refid="maven.test.classpath"/> <ant target="run.acceptance.tests"/> </tasks> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin> ...
This will hook the Ant target run.acceptance.tests
to the test phase of your Maven build. You must
ensure that the Concordion tests are not run as part of the Maven lifecycle else you'll repeat the test execution.
If things don't work as expected, you can get a little more information out of the Ant task by using -v
option to output information about the fileset it's using to look for the tests. For example,
ant -v -f build.xml generate-overview