You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by puchacz <zm...@wp.pl> on 2007/04/15 12:00:41 UTC

Struts testing

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? 

Thanx 
-- 
View this message in context: http://www.nabble.com/Struts-testing-tf3579046.html#a10000982
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Struts testing

Posted by Ted Husted <hu...@apache.org>.
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 <zm...@wp.pl> 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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts testing

Posted by puchacz <zm...@wp.pl>.
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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Struts-testing-tf3579046.html#a10018567
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Struts testing

Posted by Laurie Harper <la...@holoweb.net>.
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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts testing

Posted by Martin Gainty <mg...@hotmail.com>.
Puchacz--
I would suggest using MockStrutsTestCase
http://strutstestcase.sourceforge.net/api/servletunit/struts/MockStrutsTestCase.html
dziekuje,
Martin--

This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

----- Original Message ----- 
From: "puchacz" <zm...@wp.pl>
To: <us...@struts.apache.org>
Sent: Sunday, April 15, 2007 6:00 AM
Subject: Struts testing


>
> 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?
>
> Thanx
> -- 
> View this message in context: 
> http://www.nabble.com/Struts-testing-tf3579046.html#a10000982
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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