This task runs tests from the Varnish testing framework. This framework is bundled with Varnish on major distributions, and actually uses Varnish under the hood. The first requirement is to have Varnish installed somewhere on your system. This task works with Ant 1.7.0 or any later version.
You can download varnishtest-exec from the Maven central:
Note: You must have varnishtest-exec available. You can do one of:
If you put varnishtest-exec in your Ant classpath, you can use it this way:
<project xmlns:varnishtest="antlib:com.zenika.varnishtest.ant"> <target name="integration-test"> <varnishtest:run> <fileset dir="src/test/varnish"> <include name="**.vtc"/> </fileset> </varnishtest:run> </target> </project>
Attribute | Description | Required |
reportsDirectory | Set the directory where the reports will be written. | No. |
timeout | Set the per-test timeout in seconds. | No, defaults to 20 seconds. |
varnishdCommand | Set a different command for varnishd, for instance /usr/sbin/varnishd for unprivileged users without /usr/sbin in their PATH. | No, defaults to varnishd. |
varnishtestCommand | Set a different command for varnishtest, for instance /usr/local/bin/varnishtest. | No, defaults to varnishtest. |
workingDirectory | Set the directory in which varnishtest will be executed. Since: 0.2 | No, defaults to the base directory. |
The <varnishtest:run> task supports a nested <macro> element to pass arguments to varnishtest. It also collects the test files from any number of nested file-only Resource Collections.
It is possible to pass macros to varnishtest with a -Dname=value argument in the command line. In your test case, any occurrence of ${name} will be substitued by value. Some macros are reserved and defined by varnishtest:
Attribute | Description | Required |
name | Sets the name of the macro. The name should be unique or else this macro will be overridden. | Yes. |
value | Set the per-test timeout in seconds. | Yes. |