Coldfusion - Cant find testbox

1.1k views Asked by At

I have a coldfusion application that i would like to start writing unit tests for. I found testbox, and think it would be a great testing library to use. I followed the installation instructions, but my cold fusion app is throwing an error when i try to run my first test. I downloaded the zip file and put in in my C drive, added the mapping to my application.cfc, but it throws the following error (see below). Can anyone help me debug why it can't find textbox?

Error

Invalid CFML construct found on line 2 at column 1.
ColdFusion was looking at the following text:
testbox


The error occurred in C:/inetpub/wwwroot/tests/main.cfc: line 2
1 : // Create TestBox object
2 : testbox = new testbox.system.TestBox();
3 : ​
4 : // You can add fluent specs via addDirectory(), addDirectories(), addBundles()

Application.cfc

component {
    this.name = "A TestBox Runner Suite " & hash( getCurrentTemplatePath() );
    // any other application.cfc stuff goes below:
    this.sessionManagement = true;

    // any mappings go here, we create one that points to the root called test.
    this.mappings[ "/tests" ] = getDirectoryFromPath( getCurrentTemplatePath() );
    // Map back to its root
    this.mappings[ "/testbox" ] = expandPath( "C:/testbox/" );

    // any orm definitions go here.

    // request start
    public boolean function onRequestStart( String targetPage ){
        return true;
    }
}

main.cfc

// Create TestBox object
testbox = new testbox.system.TestBox();
​
// You can add fluent specs via addDirectory(), addDirectories(), addBundles()
testbox.addDirectory( "specs" );
​
// Run tests and produce reporter results
testbox.run()
​
// Run tests and get raw testbox.system.TestResults object
testbox.runRaw()
​
// Run tests and produce reporter results from SOAP, REST, HTTP
testbox.runRemote()

test box directory. enter image description here

1

There are 1 answers

0
Shawn On BEST ANSWER

Try changing your mapping to C:\testbox\testbox\ , or move the contents of your \testbox\testbox folder up one level. I think you may have unzipped to one too many folders. Is there a system folder inside the second testbox folder? You want to make sure that your mapping points to the folder containing your actual TestBox files.