struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lukasz Lenart <lukaszlen...@apache.org>
Subject Re: Struts 2 Testing Actions
Date Wed, 27 Nov 2013 17:03:24 GMT
2013/11/26 Damian Blazejewski <damian.blazejewski@gmail.com>:
> I have managed to sort it out. My project has two maven modules and one
> parent pom common for those modules.
> Tests are located in on of the submodules.
> As turns out, when I add servlet-api and jsp-api dependencies to the parent
> pom, the error is present.
> However, when I move those two dependencies to the module's pom which tests
> are located in, error disappears.
> So that problem is solved.
> Unfortunately, there is another issue. I have almost given up but my desire
> to start automatically testing Struts actions is stronger so I still
> struggle :)
> I have Spring dependencies in the actions itself. It would be perfect if I
> could mock them. But as far as I know I can't but I should provide spring
> application context
> defining those dependencies.
>
> When I try to extend StrutsJUnit4TestCase in my test I get the following
> error:
>
> "Looks like the Spring listener was not configured for your web app! "
>
> When I extend StrutsSpringJUnit4TestCase, I have to provide Spring
> dependencies as I said earlier.
>
> Is there any way to mock those Spring dependencies in my Struts action?

I'm not sure if I understand you - why don't you use StrutsSpringJUnit4TestCase?

http://struts.apache.org/release/2.3.x/docs/struts-2-junit-plugin-tutorial.html
http://struts.apache.org/release/2.3.x/docs/testing-actions.html


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

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


Mime
View raw message