Apache Ant tasks Execute Citrus with Apache Ant

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

Note: We discontinue to provide Citrus Ant tasks from version 2.0 onwards. This is because you can easily use the usual JUnit or TestNG Ant tasks for Citrus test execution. However if you want to use the Citrus Ant tasks feel free to fallback to the latest stable version provided.

Latest stable release: 2.0

The Apache 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.*"/>

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.