struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurie Harper <lau...@holoweb.net>
Subject Re: [S2] Testing, getting jsp output.
Date Fri, 26 Sep 2008 20:00:41 GMT
GF wrote:
> Hello
> I'm writing tests on application that uses Struts2.
> To test the actions, I use about a technique similar to the one
> described here http://itefforts.blogspot.com/2007/08/struts2-spring-junit.html
> 
> I wish to do more and test the Jsp (and Tiles) output too.
> That code does this:
> 
> response = new MockHttpServletResponse();
> ServletActionContext.setResponse(response);
> 
> I can set:
> proxy.setExecuteResult(true);
> 
> with Jsp junit tests continue to run smootly. (with Tiles, I have some
> errors, but i have still to work on them..)
> OK.
> In few words I want to get the output that Struts2 sends to the
> ServletResponse as a String and execute some tests on it.
> 
> Any idea?
> thank you!

It rather depends on what implementation of MockHttpServletResponse 
your're using, but if you look at the API docs I expect you'll find 
something like, for example (from Spring's implementation), a 
getContentAsString() method.

L.


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


Mime
View raw message