You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Asthana, Rahul" <Ra...@CIBC.com> on 2006/10/26 23:19:59 UTC

unit testing struts actions

We are thinking of designing a unit test plan for our struts based application. We have found in past that Junits for struts action are cumbersome to write and difficult to maintain.Any other suggestions? Winrunner?

Re: unit testing struts actions

Posted by Chris Pratt <th...@gmail.com>.
You might want to check out jWebUnit (http://jwebunit.sourceforge.net/).
  (*Chris*)

On 10/26/06, Asthana, Rahul <Ra...@cibc.com> wrote:
>
> We are thinking of designing a unit test plan for our struts based
> application. We have found in past that Junits for struts action are
> cumbersome to write and difficult to maintain.Any other suggestions?
> Winrunner?
>
>

Re: unit testing struts actions

Posted by Ted Husted <hu...@apache.org>.
On 10/26/06, Asthana, Rahul <Ra...@cibc.com> wrote:
> We are thinking of designing a unit test plan for our struts based application. We have found
> in past that Junits for struts action are cumbersome to write and difficult to maintain.Any
> other suggestions? Winrunner?

First, push as much business and data access logic as possible out of
the Action class and into a POJO facade that the Action can call. In
this way, you can test all that outside of the Action. The MailReader
is a fair example of this, although the data access API is quirky and
could be streamlined.

After that, what's really left to test is the UI. For UI tests, I used
WebTest for a long time, but now I strongly recommend Selenium.

* http://www.openqa.org/selenium/

The Selenium IDE (a FireFox plugin) includes a recorder to help jump
start the tests, and then you can go back and edit the tests, and also
add test that can't be easily recorded. (Like is a control disabled or
text not present.)

The best part is that the initial tests can be recorded in HTML and
the convert to real Java code. The Java code can then be run as part
of a standard JUnit test (if the Selenium proxy server is running in
the background).

I actually haven't used the Java tests myself, but I have used the C#
tests under .NET, and they work great! I'd expect the Java tests to
work at least as well.

-Ted.

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


Re: unit testing struts actions

Posted by Volker Krebs <vo...@abas.de>.
Asthana, Rahul schrieb:
> We are thinking of designing a unit test plan for our struts based application. We have found in past that Junits for struts action are cumbersome to write and difficult to maintain.Any other suggestions? Winrunner?
> 
Try:
http://strutstestcase.sourceforge.net/

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