Asserts that at least one of the nested tasks throws a BuildException.
Attribute | Description | Required |
message | Message for the exception if the condition doesn't hold true. Defaults to "Expected build failure" if expectedMessage hasn't been specified or "Expected build failure with message 'expectedMessage' but was 'actualMessage'" if it has been specified and a different exception has been thrown. | No. |
expectedMessage | Used to assert a specific exception message. The string will be looked for (case-sensitive) in the fault string; | No. |
You can use all supported tasks and types as nested element of this task.
Make the build fail with the message "expected build failure with message='failed' but was 'passed'":
<expectfailure expectedMessage="failed"> <fail>passed<fail> </expectfailure>
Make the build fail with the message "expected build failure" because the nested task doesn't cause a build failure:
<expectfailure> <echo>BUILD FAILED</echo> </expectfailure>