i need to write an ant (build.xml) file to do the following:
– run ‘rake test’
– run ‘rake rspec’
– run ‘rake features’
– if all of the above pass, then do a ‘cap deploy staging’
I am new to ant scripts, and so far, i have done:
<project name="myapp" basedir=".">
<target name="run-migrations">
<exec executable="rake">
<arg value="db:migrate"></arg>
</exec>
</target>
<target name="load-rake-task" depends="run-migrations">
<exec executable="rake"></exec>
</target>
...
</project>
This runs rake db:migrate, followed by rake, but i have not yet figured out how to capture the output of the running of the command, and better still, how to access if any of the tests failed.
How can i modify the above script to capture output and find out how many tests passed and failed in the above scenario?
To capture the output use the following attributes from
exectask :outputpropertyfor stdouterrorpropertyfor stderrresultpropertyfor RC (returncode)means something like that :
also it’s recommended to use
failonerror="true", default is false.see Ant manual / exec task for the details.