Testing Struts 1 Action classes directly is challenging, though the
StrutsTestCase extension helps quite a bit. The best solution I found
was to push as much functionality as possible into a business facade
that could be tested by JUnit or TestNG, and then to test the frontend
with Selenium or WebCanno. When this approach is followed, there is
very little left to test in the Actions.

In Struts 2, it's easy to test Action classes directly.

HTH, Ted
<http://www.husted.com/ted/blog/>

On 4/16/07, puchacz <[EMAIL PROTECTED]> wrote:

I was thinking about Struts 1. But Laurie what + and - do You see in Struts1
testing ?
Laurie Harper wrote:


Laurie Harper wrote:
>
> puchacz wrote:
>> Hi
>>
>> I would like to ask if You (as Struts programmers) see some + or - of
>> testing Struts? I know JSF where I can test  all components as a
>> standalone
>> programs. How it looks in Struts? If in Struts are a lot of dependencies
>> which make Struts testing hard to test?
>
> It depends somewhat on which version of Struts you're talking about.
> Generally, Struts 2 makes testing easier by reducing dependencies
> through well defined abstraction interfaces.
>
> For Struts 1 actions, it's a bit trickier since they generally expect
> certain HTTP Servlet-specific objects to be available. You will
> generally want to keep your actions as simple as possible and move most
> of your application/business logic into POJO service classes to make
> unit testing easier.
>
> You can also use tools such as Cactus and HtmlUnit to help with creating
> integration tests and such. Mock frameworks such as the one Martin
> mentioned can also be a good choice.
>
> L.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to