What's New With 4.0.0
Released: April 28, 2020
TestBox 4.0.0 is a major release. It has compatibility changes that you should be aware and lots of good features!

Compatibility

The major compatibility issues are the engine support removals:
    Lucee 4.5 Support Dropped
    Adobe ColdFusion 11 Dropped

Updating

It is easy to update, just type update testbox and you are done!

Major Features

TestBox Output Utilities

Sometimes you need to dump something that is in the CFC you are testing or maybe an asynchronous test. The debug() method is only accessible from your test bundle, so getting to the TestBox output utilities is not easy. We have now implemented the testing utilities into the request scope as request.testbox
This utility struct provides you with the following methods:
Method
Comment
console()
Send output to the console
debug()
Send output to the TestBox reporter debugger
clearDebugBuffer()
Clear the debugger
print()
Send output to the ColdFusion output buffer
printLn()
Same as print() but adding a <br> separator
This way in your code you can add them for better debugging, especially when testing async code:
1
request.testbox.console( "I am here" )
2
request.testbox.debug( "why is this not running" )
Copied!

Mocking Data

We have included MockDataCFC as a dependency to TestBox 4. This will allow you to mock not only objects but data as well. You can access the mocking method via the new mockData() method in all your specs. This feature is a life-saver when mocking APIs or data within your applications.
1
# Array of objects
2
var data = mockData(
3
$num = 3,
4
"author" = "name",
5
"id" = "uuid"
6
);
7
8
# An object
9
var data = mockData(
10
$returnType = "struct",
11
"author" = "name",
12
"id" = "uuid"
13
);
Copied!
Let's imagine the following object graph:
1
Author
2
Has Many Books
3
Has Many Categories
4
Has Keywords
5
Has A Publisher
Copied!
I can then use this mocking DSL to define it:
1
mockData(
2
fullName = "name",
3
description = "sentence",
4
age = "age",
5
id = "uuid",
6
createdDate = "datetime",
7
isActive = "oneof:true: false",
8
9
// one to many complex object definitions
10
books = [
11
{
12
$num = "rand:1: 3",
13
"id" = "uuid",
14
"title" = "words:1: 5",
15
"categories" = {
16
"$num" = "2",
17
"id" = "uuid",
18
"category" = "words"
19
}
20
}
21
],
22
23
// object definition
24
publisher = {
25
"id" = "uuid",
26
"name" = "sentence"
27
},
28
29
// array of values
30
keywords = [
31
{
32
"$num" = "rand:1: 10",
33
"$type" = "words"
34
}
35
]
36
);
Copied!

Release Notes

Bugs

    [TESTBOX-275] - Exception in beforeTests/afterTests not reported in a meaningful way on the ANT Junit Reporter
    [TESTBOX-278] - Fix the coverage % in HTML visualizer

New Features

    [TESTBOX-274] - New testbox output utilities struct: request.testbox
    [TESTBOX-276] - MockdataCFC is now a first class module in TestBox
    [TESTBOX-277] - New mockData() method in your base specs so you can mock any type of data
    [TESTBOX-280] - Add cfconfig.json for controlling output and consistency between testing in diff engines

Tasks

Last modified 1yr ago