When deploying with ant you have the option to specify which tests to run, e.g.
<target name="deploy">
<sf:deploy username="${sf.username}"
password="${sf.password}"
serverurl="${sf.serverurl}"
deployRoot="${dir}"
testLevel="RunSpecifiedTests"
maxPoll="300">
<runTest>Test1</runTest>
<runTest>Test2</runTest>
</sf:deploy>
We use a shared build script with the team and I'm trying to figure out how to pass a list of tests to run during the deployment from either a file or a parameter. Ideally we could do ant deploy -Dtests=Test1,Test2
I'm a very novice ant users, and I'm really struggling to figure out how to accomplish this.
I'd thought this might work and then I could hook up the list value to a command line parameter, but it complains that sf:deploy
doesn't support a nested for
element.
<target name="mydeploy">
<sf:deploy username="${sf.username}"
password="${sf.password}"
serverurl="${sf.serverurl}"
deployRoot="${dir}"
testLevel="RunSpecifiedTests"
maxPoll="300">
<for list="Test1,Test2" param="test">
<sequential>
<runTest>"@{test}"</runTest>
</sequential>
</for>
</sf:deploy>
</target>
Is there anyway to build the list of <runTest>
elements dynamically based on a command line input or file so that I don't need to edit my build.xml
script everytime I want to do a deploy with a subset of tests?
Perhaps I should just be abandoning ant in favor of something like grunt?