testbox errors when using complete null support in railo

Description

When using complete null support in Railo 4.2, testbox throws the following error:
Message The parameter options to function init is required but was not passed in.
Stacktrace The Error Occurred in
---\lib\testbox\system\TestBox.cfc: line 351
349: if( structKeyExists( target, "run" ) ){
350: // Run via BDD Style
351: new testbox.system.runners.BDDRunner( options=variables.options )
352: .run( target, arguments.testResults );
353: }

called from ---\lib\testbox\system\TestBox.cfc: line 165
called from ---\lib\testbox\system\TestBox.cfc: line 96
called from ---\www\tests\index.cfm: line 42

(sensitive file path information removed).

IMO, the issue is the runRaw function which does not have required on the options argument but also does not provide a default. Providing a default there of {} (empty struct) resolves the issue. You could also alter the logic on line 124 to handle the isNull() option.

Please let me know if I can provide more information.

Activity

Show:
Brad Wood
October 22, 2014, 6:29 PM

Note ColdBox and the rest of the Box family has never really been tested with full null support, though we do know it doesn't work. There is this ticket to add support: COLDBOX-202. Note, we also have this ticket for strict scope support:

Would you mind submitting a pull request for this fix?

Ryan Guill
October 22, 2014, 6:32 PM

I'd be happy to, is defaulting the options parameter in run, runRaw and runRemote and appropriate fix in your opinion? I don't see any downsides to that approach but I haven't done a thorough analysis.

Brad Wood
October 22, 2014, 6:46 PM

Hopefully Luis will chime in since he's more familiar with that code. Defaulting is probably ok, but I'm guessing you'd need to change the structKeyExists() check to a structIsEmpty() check. isNull() is probably fine now that TestBox supports only CF9 and up. We couldn't do that back when we supported CF8.

Ryan Guill
October 22, 2014, 6:48 PM

yeah, I think adding an !isNull check to the structKeyExists is probably the way to go as to not change the meaning of things.

Ryan Guill
October 27, 2014, 2:00 PM

Looks like someone else beat me to the punch: https://github.com/Ortus-Solutions/TestBox/pull/2

Fixed

Assignee

Luis Majano

Reporter

Ryan Guill

Labels

Components

Fix versions

Affects versions

Priority

Minor
Configure