Howdy all. I'm working on some integration tests w...
# box-products
j
Howdy all. I'm working on some integration tests with Testbox, and I'm wondering if there is any way from within my tests to access the contents of the`args` param from the
setView
call in the handler?
w
Not sure if this will help you since I never tried this myself, but worth a try: in the setview method in coldbox.system.web.context,requestContext the args wil be recorded in the prc in a var called
currentViewArgs
. So I guess you can display or test your variables for example like this
Copy code
var event= get("some/route");
debug(event.getPrivateValue("currentViewArgs");
expect( event.getPrivateValue( "currentViewArgs" ) ).tohavekey( "someArgument" );
expect( event.getPrivateValue( "currentViewArgs" ).someArgument ).tobe( someValue );
j
Hey! That's it. I swear I dumped that out to investigate what was in it, but I obviously missed it. I'm super pumped about this. Thanks, Wil! You just made my day.
w
Well, nice to know. I am exploring all possibilities of testbox right now, so nice to know this is possible 👍
j
Yep. I just added that into a few tests and it works like a charm. Thanks again.