Permalink
Fetching contributors…
Cannot retrieve contributors at this time
110 lines (86 sloc) 4.29 KB
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
This is an ANT script that runs the MXUnit Integration tests for Taffy
Step 1 in continuous integration!
It assumes that you're running taffy from your web root. Never tried
from an external path + mapping.
-->
<project name="Taffy Integration Tests" basedir="." default="runtests">
<!-- define non-standard tasks -->
<taskdef resource="org/eclipse/jgit/ant/ant-tasks.properties">
<classpath>
<pathelement location="lib/org.eclipse.jgit.ant-1.0.99.0.6-UNOFFICIAL-ROBERTO-RELEASE.jar"/>
<pathelement location="lib/org.eclipse.jgit-2.0.0.201206130900-r.jar"/>
<pathelement location="lib/jsch-0.1.48.jar"/>
</classpath>
</taskdef>
<target name="init">
<!-- //////// DIRECTORY AND CFC PATH SETUP (used in all targets) -->
<!-- what's the directory name of your application? this value will be used throughout this build file;
if you don't want that, just replace the references to ${application.name} with your desired values -->
<property name="application.name" value="taffy" />
<!-- what's the name of the directory where your tests live? Note: this is just the name
of the directory, not the full path-->
<property name="test.dir.name" value="tests/tests" />
<!-- where do your tests live, relative to this build file? test.dir.location will be a
full path to a directory -->
<property name="test.dir.location" location="tests/tests" />
<!-- what is the cfc dot-notation path to that directory, as ColdFusion sees it? -->
<property name="test.cfcpath" value="taffy.tests.tests" />
<!-- //////// MXUNIT ANT TASK SETUP (used in runtests and junitreport targets) -->
<!-- what server and port should your tests run against? -->
<property name="test.server" value="jenkins.local" />
<property name="test.serverport" value="80" />
<!-- what "runner" URL should the tests hit. In this example, you'd be hitting
http://localhost:80/DirectoryNameOfYourProject/test/HttpAntRunner.cfc
Simply copy mxunit/samples/HttpAntRunner.cfc into your test directory! -->
<property name="test.runner" value="/${application.name}/${test.dir.name}/HttpAntRunner.cfc" />
<!-- this is where the xml and html will live for the report generator -->
<property name="test.output" location="${test.dir.name}/output" />
<property name="test.output.xml" location="${test.output}/xml" />
<property name="test.junitoutput" location="${test.output}/html" />
<!-- //////// JAR FILES WE NEED FOR EXTERNAL TASKS -->
<!-- where does the mxunit ant jar file live? it's easiest to copy it out of the mxunit install and put it into your app
You can also put any other ant-relatd jars in this directory; for example, if you want to use svnant, you'll need to put those jars here
-->
<path id="project.classpath">
<fileset dir="lib">
<include name="**/*.jar" />
</fileset>
</path>
<!-- dump the properties -->
<echoproperties prefix="test" />
</target>
<target name="clean" depends="init">
<mkdir dir="${test.output}" />
<mkdir dir="${test.output.xml}" />
<mkdir dir="${test.junitoutput}" />
</target>
<target name="runtests" description="Make output directories and run the MXUnit task" depends="init,clean">
<!-- first, make sure Taffy is initialized -->
<get src="http://jenkins.local/taffy/tests/?dashboard&amp;reload=true" dest="init.result" />
<delete file="init.result" />
<!-- <delete dir="${test.output}" failonerror="false" /> -->
<taskdef name="mxunittask" classname="org.mxunit.ant.MXUnitAntTask" classpathref="project.classpath" />
<mxunittask
server="${test.server}"
port="${test.serverport}"
defaultrunner="${test.runner}"
outputdir="${test.output.xml}"
verbose="true"
failureproperty="testsfailed">
<directory path="${test.dir.location}" recurse="true" packageName="${test.cfcpath}" componentPath="${test.cfcpath}" />
</mxunittask>
<fail if="testsfailed" message="Build fails because tests failed" />
<!-- generate pretty reports -->
<antcall target="junitreport" />
</target>
<target name="junitreport" depends="init" description="Runs the report without running the tests">
<junitreport todir="${test.junitoutput}">
<fileset dir="${test.output.xml}">
<include name="*.xml" />
</fileset>
<report format="frames" todir="${test.junitoutput}" />
</junitreport>
</target>
</project>