What's New With 5.0.0
May 10, 2022
TestBox 5.x series is a major bump in our library. Here are the major areas of improvement and the full release notes.

TestBox Engine Support
We have dropped Adobe 2016 support and added support for Adobe 2023 and Lucee 6+

TestBox Batch Code Coverage
Due to memory limitations in CI environments, larger codebases cannot run all tests as a single
testbox run
command. Instead, specs are run in a methodical folder-by-folder sequence, separating the testbox run
out over many requests and thus working around the Out-Of-Memory exceptions.While this works, it prevents accurate code coverage reporting since only a small portion of the tests are executed during any request. The generated code coverage report only shows a tiny fraction of the coverage - say, 2% - and not the whole picture
TestBox 5 introduces a
CoverageReporter
component which- 1.Runs on every TestBox code coverage execution
- 2.Loads any previous coverage data from a JSON file
- 3.Combines the previous coverage data with the current execution's coverage data (file by file and line by line)
- 4.Persists the COMBINED coverage data to a JSON file.
- 5.Returns the COMBINED coverage data for the
CoverageBrowser.cfc
to build as an HTML report
When setting
url.isBatched=true
and executing the batched test runner, the code coverage report will grow with each sequential testbox run
command.
MockBox now supports a
$spy( method )
method that allows you to spy on methods with all the call log goodness but without removing all the methods. Every other method remains intact, and the actual spied method remains active. We decorate it to track its calls and return data via the $callLog()
method.Example of CUT:
void function doSomething(foo){
// some code here then...
local.foo = variables.collaborator.callMe(local.foo);
variables.collaborator.whatever(local.foo);
}
Example Test:
function test_it(){
local.mocked = createMock( "com.foo. collaborator" )
.$spy( "callMe" )
.$spy( "whatever" );
variables.CUT.$property( "collaborator", "variables", local.mocked );
assertEquals( 1, local.mocked.$count( "callMe" ) );
assertEquals( 1, local.mocked.$count( "whatever" ) );
}

We have focused on this release to lazy load everything as much as possible to allow for much better testing performance. Check it out!

You can now use the
skip( message )
method to skip any spec or suite a-la-carte instead of as an argument to the function definitions. This lets you programmatically skip certain specs and suites and pass a nice message.it( "can do something", () => {
...
if( condition ){
skip( "Condition is true, skipping spec" )
}
...
} )
Last modified 28d ago