Running Tests
TestBox ships with several test runners internally but we have tried to simplify and abstract it with our testbox
object which can be found in the testbox.system
package. The TestBox object allows you to execute tests from a variety of entry points and languages such as CFC, CFM, HTTP, NodeJS, SOAP or REST. You can also make your CFC's extend from our BaseSpec
class so you can execute it directly via the URL. The main execution methods are:
Info We encourage you to read the API docs included in the distribution for the complete parameters for each method.
run()
Arguments
run()
ArgumentsHere are the arguments you can use for initializing TestBox or executing the run()
method
runRemote()
arguments
runRemote()
argumentsHere are the arguments you can use for executing the runRemote()
method:
The bundles argument which can be a single CFC path or an array of CFC paths or a directory argument so it can go and discover the test bundles from that directory. The reporter argument can be a core reporter name like: json,xml,junit,raw,simple,dots,tap,min,etc or it can be an instance of a reporter CFC. You can execute the runners from any cfm template or any CFC or any URL, that is up to you.
Global Runner
TestBox ships with a global runner that can be used to run pretty much anything. You can customize it or place it wherever you need it:
Test Browser
TestBox ships with a test browser that is highly configurable to whatever URL accessible path you want. It will then show you a test browser where you can navigate and execute not only individual tests, but also directory suites as well.
ANT Runner
In our test samples and templates we include an ANT runner that will be able to execute your tests via ANT. It can also leverage our ANTJunit reporter to use the junitreport task to produce JUnit compliant reports as well. You can find this runner in the test samples and runner template directory.
Bundle(s) Runner
Test Runner
If you make your test bundle CFC inherit from our testbox.system.BaseSpec class, you will be able to execute the CFC directly via the URL: ```javascript http://localhost/test/MyTest.cfc?method=runRemote ``` You can also pass the following arguments to the method via the URL: * **testSuites** : A list or array of suite names that are the ones that will be executed ONLY! * **testSpecs** : A list or array of test names that are the ones that will be executed ONLY! * **reporter** : The type of reporter to run the test with ```javascript http://localhost/test/MyTest.cfc?method=runRemote&reporter=json ```
Directory Runner
SOAP Runner
You can run tests via SOAP by leveraging the runRemote() method. The WSDL URL will be
HTTP/REST Runner You can run tests via HTTP/REST by leveraging the runRemote() endpoint. The URL will be
NodeJS Runner
There is a user-contributed NodeJS Runner that looks fantastic and can be downloaded here:
https://www.npmjs.com/package/testbox-runner
Just use node to install:
Last updated