struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Miguel Almeida <mig...@almeida.at>
Subject Can Struts Junit plugin be used to test the redirect result of an action
Date Wed, 21 Sep 2011 15:25:44 GMT
I am using the Struts Junit plugin
(http://struts.apache.org/2.2.3.1/docs/struts-2-junit-plugin-tutorial.html ), extending the
StrutsSpringTestCase for a regression test of an action in my application.

(Optional reading: 
Long story short on the problem, the action adds a record to a database
via hibernate. The result is a redirect to execute() of the same class,
whose prepare() populates a List<Record> object with all the records
available. For some reason, the prepare fires as it should, but returns
the old number of items. Only a refresh shows the page with the correct
results. For an odd reason, sleeping the thread before calling the dao's
code that retrieves the list for 1 second also makes the result to be
correctly updated.)

The action result is a redirectAction, that, well, redirects to another
action. The test doesn't call this second method, though.
Is it possible with this base test case to make it call the 2nd action?


Regards,

Miguel Almeida



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message