New testbox output utilities struct: request.testbox

Description

Original Idea

Sometimes you need to dump something that is in the CFC you are testing. The debug() method is only accessible from your test cfc, so usually people end up writing temp variables to the request scope and come up with a homemade solution to this (see recent thread in testing on slack channel).

MXUnit had a request.debug() feature: https://github.com/mxunit/mxunit/wiki/Using-request.debug() I don't know if it needs to be implemented exactly the same way (I never used this, and didn't know about it until someone mentioned it in slack).

Implementation

We have created a request.testbox struct that will contain all the output utilities that TestBox Provides:

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:

Activity

Show:
Luis Majano
March 10, 2020, 10:25 PM

I think this will be a great addition. I am thinking that maybe we can call it request.testbox and add much more features to it.

Pete Freitag
March 11, 2020, 1:43 PM

Sounds good to me Luis!

Assignee

Luis Majano

Reporter

Pete Freitag

Labels

None

Fix versions

Priority

Trivial
Configure