TestBox, DocBox, and CBORM
Add debug output via `request.testbox`
request.testbox.debug(
variables.ormUtil.getHibernateVersion()
);
Send debug info to the console
request.testbox.console(
"Reached point XYZ"
);
// in a spec:
console( "Reached point X!" );
Clear debug output buffer
request.testbox.clearDebugBuffer();
// in your spec:
clearDebugBuffer();
Print to the ColdFusion output buffer
request.testbox.print( "line of text" );
// in your spec:
print( "debug me please" );
Print to the ColdFusion output buffer
-- now with line breaks!
request.testbox.printLn( "line of text" );
// in your spec:
printLn( "debug me please" );
Ray Camden's MockDataCFC is now in TestBox core
# Array of objects
var data = mockData(
$num = 3,
"author" = "name",
"id" = "uuid"
);
[
{
author: "Frank Smith",
id: e3ed98ed-8103-440e-bcb6-52f97f400bd9
},
{
author: "Gary Stroz",
id: bdf130c3-c1e4-4b7e-b35e-128d376600e6
},
{
author: "Lynn Padgett",
id: b8681971-747f-4501-a059-3be433021ee9
}
]
box testbox run reporter=mintext
Clicking a filename in a stacktrace or "Failure Origin" will open the file in your favorite editor.
Dry Run : Ability to retrieve tests to execute
New Testing UI Experience
VSCode Testing Integration
JMESPath JSON Structure Expectations
TestBox Feature Definitions via YAML
Native Gherkins Support
Configure documentation via "alias" short names
variables.docbox = new docbox.DocBox(
strategy = "docbox.strategy.api.HTMLAPIStrategy",
properties = {
projectTitle : "DocBox Tests",
outputDir : variables.testOutputDir
}
);
variables.docbox = new docbox.DocBox(
strategy = "HTML",
properties = {
projectTitle : "DocBox Tests",
outputDir : variables.testOutputDir
}
);
docbox = new docbox.DocBox( "JSON", {
outputDir : expandPath( "resources/assets/docs" ),
projectTitle: "Vehicles API"
});
docbox.DocBox()
.addStrategy(
"HTML",
{ outputDir : variables.HTMLOutputDir }
)
.addStrategy(
"UML",
{ outputFile : variables.XMIOutputFile }
)
.generate(
source = expandPath( "/models" ),
mapping = "tests",
excludes = "(coldbox|build\-docbox)"
);
New Hibernate event support
New CBORM interception points
component {
property name="log" inject="logbox:logger:this";
function ORMEvict( struct interceptData ){
if( log.canDebug() ){
log.debug( "Entity evicted:", interceptData.entity );
}
}
}
var params = [
createUUID(),
"Michael",
"Born"
];
ORMExecuteQuery( "INSERT INTO users ( ?, ?, ? )", params );
JDBC-style parameters:
No longer supported in Hibernate 5.3+
var params = [
createUUID(),
"Michael",
"Born"
];
ORMExecuteQuery( "INSERT INTO users ( ?1, ?2, ?3 )", params );
Use JPA-style (numbered) parameters instead:
var util = getInstance( "ORMUtilSupport@cborm" );
myNewEntity.save( transactional = !util.isInTransaction() );
Easily avoid nesting transactions if the executing code is already in a transaction.
var util = getInstance( "ORMUtilSupport@cborm" );
if ( left( util.getHibernateVersion(), 3 ) < 4.0 ){
// Hibernate 3 implementation
} else {
// Hibernate 4+ implementation
}
Toggle implementations for newer/older Hibernate versions