I am trying to identify a task that emits (using an echo) a message when a target completes, regardless of whether the target was successful or not. In particular, the goal performs the task of running some unit tests, and I want to convey a message about where the results are available:
<target name="mytarget"> <testng outputDir="${results}" ...> ... </testng> <echo>Tests complete. Results available in ${results}</echo> </target>
Unfortunately, if the tests fail, the task fails and execution fails. Thus, the message is displayed only if the tests pass - opposite to what I want. I know that I can pose a task to a task, but it will make it easier for users to skip this message. Am I trying to do this?
Update: It turns out I'm stupid. I had haltOnFailure = "true" in my <testng> task, which explains the behavior that I saw. Now the problem is that setting this value to false leads to the successful completion of the ant build, even if the tests fail, which I don't want. The answer below, using the task, looks like I want ...
java unit-testing ant
Kris pruden
source share