ANT tasks Execute Citrus with ANT

You can execute Citrus tests with ANT. The Citrus ANT tasks simplify the test execution so you just include predefined tasks into your project ANT build file.

Latest stable release: 2.0

The ANT tasks can execute Citrus test cases in several modes. You can either run one single test by its name or all tests in a test package. In addition to that you can also use TestNG XML test suite files to execute your tests.

Here is a simple usage example:

<typedef resource="citrustasks" classpath="lib/citrus-ant-tasks-2.0.jar"/>

<target name="citrus.run.tests" description="Runs all Citrus tests">
    <citrus package="com.consol.citrus.*"/>
</target>

Following parameters are supported in the citrus tasks definition.

suitename The name of the test suite to execute (List of suites is also supported, separated by space
test List of test names that should be executed (space separated list of test names)
package List of test packages to execute. all test files in these packages are executed in this test run
testngXml TestNG XML execution file describing the tests/test suites to execute

In the Citrus samples section you can find several 'build.xml' scripts, which give examples how to use the Citrus ANT tasks in order to run tests. You can also see how single test execution is extended with ANT prompts, so the user is asked for test name inputs during execution.

Please be aware of Java classpath settings in your ANT build file. Citrus is executed via Java runtime and therefore with Java task execution in ANT. The Citrus ANT tasks require a classpath setting and a default folder structure within your ANT project. So customization is limited to a certain level.

In case you want to have more customization opportunities you can also use the pure ANT Java tasks for TestNG and JUnit in order to execute the Citrus test cases. The Citrus test case Java class is nothing but a normal TestNG or JUnit executable. In cas you are familiar with ANT you may want to use this option because you then have full power of customizing your build.