Good morning. Hope a good weekend was had by all. ...
# testing
j
Good morning. Hope a good weekend was had by all. After a few false starts, I feel like I'm actually and finally building up some momentum with testing. Eric Peterson gave a great presentation on cbPlaywright for end-to-end testing at ITB, which was the match that lit the fuse. I've been spending as much time as I can working on various kinds of testing since then. I have a fairly decent handle on end-to-end tests with cbPlaywright (seriously, what a great tool), and I have a decent-ish (but growing) handle on unit tests and mocking with Testbox. So right now I am working on integration tests with Testbox. I'm trying to test a typical form submission and the associated results on a results page. To pass in all the form fields for my integration tests I'm doing something like
getRequestContext().setValue( "employeeName", "Joseph Chastain" );
before the
execute
call. I know I can get the rendered results page and check for various things with
expect( event.getRenderedContent() ).toInclude(  "whatever" );
But I'm hoping I can get specific values that are calculated in the handler. It looks like I can do this if I stored them in the PRC scope with
event.getPrivateCollection()
but I don't typically use the PRC scope. I pass the values to the results view via the
args
param in the
event.setView()
call in the handler. Is there a way to get the values in the args param in the test? Or do I need to start using the PRC scope if I want to do this? I checked the docs but, if there is anything, I didn't see it. Appreciate any insights on this. Thanks.
tl;dr Can I access the args param that exists in my handler in an integration test that is testing the handler?
s
That might be box-specific enough that you might need to ask in #box-products ? My approach with ColdBox handler testing is different, since I tended to invoke the controller directly and not work at the rendered content level at all.
I also always tried to use the default view convention and avoided
setView()
so all my observable data was in the
rc
directly (I never used
prc
).
j
Thanks, Sean. I think I'll take it over there.