You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Karr, David" <da...@wamu.net> on 2008/03/29 23:09:23 UTC

Possible to unit test actions through type converters?

This might be a violation of pure "unit test" guidelines, but is it
practical to test an action such that the type converters for properties
are automatically executed, just like they would normally?  It's nice
that actions are plain POJOs, but I wonder if it's practical to test the
processing of property values into the type converters.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Possible to unit test actions through type converters?

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
I think it is possible but haven't tried it myself.

If you extend StrutsTestCase you'll have access to a Configuration 
object and the ActionProxyFactory.  You should be able to setup your 
action and invoke it through the parameters interceptor.  I couldn't 
find any example unit tests that do this in Struts or XWork though. 
It'll be horrible to setup but once complete you'll be able to reuse it.

Karr, David wrote:
> This might be a violation of pure "unit test" guidelines, but is it
> practical to test an action such that the type converters for properties
> are automatically executed, just like they would normally?  It's nice
> that actions are plain POJOs, but I wonder if it's practical to test the
> processing of property values into the type converters.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org