2013/3/18 Christian Grobmeier <[email protected]>:
> I debugged a good while and figured out how it can be done, basically.
>
> The trick is, you give it a special config:
>
> @Override
>     protected String getConfigPath() {
>         return "struts-convention.xml";
>     }
>
> This config above contains more or less everything which is also
> contained in struts-plugin.xml of the convention plugin. Unfortunately
> I didn't find a way to include the original file or how to use
> "convention-default". It seems it isn't loaded and I need to push it
> manually, which i did.
>
> I could create an ViewAction which is then forwarded to
> view-success.jsp, as desired.
>
> One problem I face is now that it seems as view-success.jsp is not
> rendered. When I read the output of this file its always "". I have no
> idea why it's like that at the moment.
> I looked into StrutsJUnit4TestCase (line 248) and it seems
> struts-default.xml is always loaded. So I would expect there are all
> components there to render it. I already tried ftl, which is used
> often by teh other testcases, no success.

There was never an option to grab and rendered output, but maybe it
would be useful, take a look on FreeMarkerResultTest, especially on
setUp() method, maybe doing the same will solve your problem.

> That said, besides the return value of executeAction is not useful,
> this already works:
>
> public class StrutsJUnit4ConventionTestCaseTest extends
> StrutsJUnit4TestCase<ViewAction> {
> ...
> ViewAction action = this.getAction();
> // assert action members

Good job :-)


Regards
-- 
Ɓukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to