Getting Started
To get started with using the Badboy Ant plugin you first need to download the
jar file containing the plugin tasks and place them in your Ant “lib” directory. For example, if you have Ant installed at “C:\programs\apache-ant-1.8.2”, then place the jar file in “C:\programs\apache-ant-1.8.2\lib”. There are other ways to do it but this is the simplest and most tried and true method.
Once you have the jar file installed you have to do just one more thing to your build file before you can use the Badboy Ant tasks – just add two taskdefs at the top of your build file (right after the project tag) like so:
<taskdef name="runscript" classname="com.badboy.ant.RunScriptTask"/>
<taskdef name="runTestPlan" classname="com.badboy.ant.WTMTask"/>
Once you’ve done this you’re ready to use the tags just like any other inside your build file.
Using the RunScript Tag
Once you’ve declared the tasks putting the tags to use is easy. Running a simple script using Badboy on the same computer as the build script is running is, in fact, just a single tag:
<runscript script="test.bb"/>
This will fire up Badboy and cause it to run the script from beginning to end without stopping. All the niceties such as auto-dismissing popups, Javascript errors or other problems that might cause the script to halt midstream are taken care of for you. In addition, if the script has errors or assertion failures it will cause the build to fail and abort – just as if you had introduced a compile error or a normal unit test failure!
If you prefer different behavior you can stop the build from failing when a script fails by simply adding a failOnError attribute and setting it to false:
<runscript script="test.bb" failOnError="false"/>
If you want to pass variables to your script then you can easily add them as child elements:
<runscript script="test.bb">
<var name="foo">bar</var>
<var name="cat">dog</var>
</runscript>