Hi,

You can execute more than one action in the same test method, as long
as you create a new request and actionProxy, something like this:

@Test @Config(actionName="foo")
public void someTest() {
  ...some test code...

  // second request:
  request = new MockHttpServletRequest(); // and then add your params
  response = new MockHttpServletResponse();
  createActionProxy(null, "testAnotherAction", null);
  actionProxy.execute(); // executes the testAnotherAction action
  assertTrue(....);
}

If you are using maven, then you can add your test struts.xml files in
'src/test/resources' folder.

Regards,
Gabriel

2011/8/8 Christian Grobmeier <grobme...@gmail.com>:
> Hello Gabriel,
>
> thanks for the work, it looks really good!
>
> What I not like so much is the fact that the test methods name must
> match the Actions name. I didn't find this very intuitive. I could use
> the @Config option, which I like much more, but then i face the
> problem that "one test method = one action". In some cases I might
> need the flexibility to call multiple actions in one test method.
>
> What I like is the support of another struts.xml file. I have
> mentioned this on the other mail to Maurizio.
>
> At the moment I must say I tend to Maurizios solution. I solves
> everything and is part of the struts 2 project. But I will watch your
> project from now on.
>
> Cheers!
> Christian
>
> On Wed, Aug 3, 2011 at 9:12 PM, Gabriel Belingueres
> <belingue...@gmail.com> wrote:
>> There you go:
>>
>> http://code.google.com/p/struts2-junit/
>>
>> Regards,
>> Gabriel
>>
>> 2011/8/3 Christian Grobmeier <grobme...@gmail.com>:
>>> Hi,
>>>
>>> at the moment I found out to test without that class. Not really a
>>> full test, but it works for my needs at the moment. Therefore I can
>>> wait until you have pushed your code to google. Please ping this list
>>> once it is done - guess some others ahve an interest in it too :-)
>>>
>>> Cheers
>>> Christian
>>>
>>> On Wed, Aug 3, 2011 at 7:54 PM, Gabriel Belingueres
>>> <belingue...@gmail.com> wrote:
>>>> Hi,
>>>>
>>>> StrutsJUnit4TestCase is really tricky. I found few pointers in the web.
>>>> I'm currently using it successfully for my modest testing
>>>> requirements, but you don't need to provide a web.xml file.
>>>>
>>>> When I say integration testing utility, I mean testing a full blown
>>>> interceptor stack with your actions and interceptors. If you want to
>>>> test either your actions or interceptors in isolation, you may not
>>>> need this.
>>>>
>>>> Funny enough, I'm currently in the process of open sourcing our Struts
>>>> 2 integration testing utility, which is based on StrutsJUnit4TestCase
>>>> (only tested it on Struts 2.2.3 I'm afraid), so if you can hold on a
>>>> few minutes, you may download it from google code.
>>>>
>>>> Regards,
>>>> Gabriel
>>>>
>>>> 2011/8/3 Christian Grobmeier <grobme...@gmail.com>:
>>>>> Hello all,
>>>>>
>>>>> today I tried to figure out how one can use StrutsJUnit4TestCase. I am
>>>>> currently puzzled. I found docs for the older implementation for
>>>>> Junit3 of course, but nothing on the StrutsJUnit4TestCase class. Any
>>>>> pointers?
>>>>>
>>>>> With the old stuff i simply did: this.executeAction() and all was
>>>>> well. Now it seems I have to give the class a web.xml - how?
>>>>>
>>>>> Thanks in advance
>>>>>
>>>>> Christian
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> http://www.grobmeier.de
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
>
>
>
> --
> http://www.grobmeier.de
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

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

Reply via email to