Docs for Assertion CFCs inadequate, or functionality just doesn't work?


I'm reading this:, specifically the "CFC Assertions" bit.

I can get Testbox to call in a CFC using this:

But as soon as I put any functions in the CFC, my test run starts erroring with:

Complex object types cannot be converted to simple values.

The expression has requested a variable or an intermediate expression result as a simple value. However, the result cannot be converted to a simple value. Simple values are strings, numbers, boolean values, and date/time values. Queries, arrays, and COM objects are examples of complex values.
The most likely cause of the error is that you tried to use a complex value as a simple one. For example, you tried to use a query variable in a cfif tag.

The error occurred in C:/apps/adobe/ColdFusion/10/cfusion/wwwroot/frameworks/testbox/1.0.0/testbox/system/testing/BaseSpec.cfc: line 338
Called from C:/apps/adobe/ColdFusion/10/cfusion/wwwroot/shared/git/cflib/makeStopwatch/TestMakeStopwatch.cfc: line 5
Called from C:/apps/adobe/ColdFusion/10/cfusion/wwwroot/frameworks/testbox/1.0.0/testbox/system/testing/runners/UnitRunner.cfc: line 52
Called from C:/apps/adobe/ColdFusion/10/cfusion/wwwroot/frameworks/testbox/1.0.0/testbox/system/testing/TestBox.cfc: line 323
Called from C:/apps/adobe/ColdFusion/10/cfusion/wwwroot/frameworks/testbox/1.0.0/testbox/system/testing/TestBox.cfc: line 161
Called from C:/apps/adobe/ColdFusion/10/cfusion/wwwroot/frameworks/testbox/1.0.0/testbox/system/testing/TestBox.cfc: line 94
Called from C:/apps/adobe/ColdFusion/10/cfusion/wwwroot/shared/git/cflib/makeStopwatch/runTests.cfm: line 6
336 : var methodArray = structKeyArray( oAssertions );
337 : for( var thisMethod in methodArray ){
338 : this.$assert[ thisMethod ] = oAssertions[ methodArray ];
339 : }
340 :

TestMakeStopwatch.cfc: line 5 is the call to addAssertions()

Also: the docs for custom assertions say this:

The function should return itself (this) if the actual value passes

You'd better clarify what you want ppl to return when the function is in a CFC, because within a CFC, this refers to the CFC, not the function. I presume you mean this:


An example CFC in the docs is probably necessary here.


Luis Majano
December 27, 2013, 2:18 PM

Ok, this is now fixed. This was in flux while building the docs and core. It is now updated. Thanks for the keen eye:

Adam Cameron
December 27, 2013, 2:59 PM

Good stuff Luis! And the way the custom assertions actually work is a lot better than how the docs had suggested. Nice one.

Luis Majano
December 27, 2013, 3:01 PM

Gracias!! I broke my brain on those ones, I hated every implementation I had before.

Luis Majano
Ortus Solutions, Corp (
P/F: 1-888-557-8057
Direct: (909) 248-3408

ColdBox Platform: (
ContentBox Platform: (
Linked In:

Social: ( | ( | ( | (



Luis Majano


Adam Cameron




Fix versions

Affects versions