Creating a Custom HTTPAntRunner.cfc

Often, your build.xml file will use the default HttpAntRunner.cfc inside of the mxunit package:

Common use of MXUnit ANT Task

However, it's possible that your tests need to be run under the context of your application. This is certainly true if you're using CF's built-in ORM functionality. It's also true if your tests or the code under test access application-scoped variables. Finally, this is probably true if you're testing controllers in a framework such as ColdBox.

Fortunately, you can solve this in two simple steps:

  1. Create a custom HttpAntRunner.cfc and put it in your application. Perhaps it's at c:/apps/MyBadassApp/tests/HttpAntRunner.cfc
  2. In your ANT file, point your mxunit defaultRunner to this new CFC
    Your custom HttpAntRunner.cfc

    then:

    ANT task points to the location of your new runner
I do this for every application I create

Labels

ant ant Delete
httpantrunner httpantrunner Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.