Re: Unit testing Struts2 + Spring application?

2008-07-24 Thread Jukka Välimaa
Check out Appfuse http://appfuse.org/display/APF/AppFuse+QuickStart,
Struts 2 Modular version. It has this kind of setup

2008/7/23 Paweł Wielgus [EMAIL PROTECTED]:

 Hi Joachim,
 isn't StrutsTestCase for Struts 1.x ?

 Best regards,
 Paweł Wielgus.

 On 23/07/2008, Joachim Ansorg [EMAIL PROTECTED] wrote:
  Hi,
   I'm working on a Struts2 application which uses Spring as factory.
   I'm using Struts 2.1 and  Spring 2.5.
 
   The problem is for me that
 - I don't know how to use StrutsTestCase so the created action are
  spring-wired
 - How to make the tests use my /WEB-INF/struts.xml file as Struts
  configuration
 
   Does anybody have this kind of setup working? If yes, are there any
 tricks
  to do that?
 
   Thanks a lot,
   Joachim
 
  -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
 
 



Re: Unit testing Struts2 + Spring application?

2008-07-24 Thread Norris Shelton
Take a look at this.  This is set-up for Maven.  I had to copy my 
/WEB-INF/applicationResources.xml to test/resources/



package mil.army.usarec.ars.techdemo;

import static org.junit.Assert.*;
import org.junit.*;
import org.junit.runner.*;
import org.springframework.beans.factory.annotation.*;
import org.springframework.test.context.*;
import org.springframework.test.context.junit4.*;

/**
 * DemoAction Tester.
 * @author SheltonN
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {/applicationContext-test.xml})
public class DemoActionTest {

@Autowired
private SomeService someService = null;


/**
 * Tester for Method: demoForm().
 */
@Test
public void testDemoForm() throws Exception {
assertNotNull(SomeService was not injected by Spring, someService);
assertEquals(some other value, someService.getSomethingElse());
}
}





- Original Message 
From: Jukka Välimaa [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Thursday, July 24, 2008 7:23:59 AM
Subject: Re: Unit testing Struts2 + Spring application?

Check out Appfuse http://appfuse.org/display/APF/AppFuse+QuickStart,
Struts 2 Modular version. It has this kind of setup

2008/7/23 Paweł Wielgus [EMAIL PROTECTED]:

 Hi Joachim,
 isn't StrutsTestCase for Struts 1.x ?

 Best regards,
 Paweł Wielgus.

 On 23/07/2008, Joachim Ansorg [EMAIL PROTECTED] wrote:
  Hi,
   I'm working on a Struts2 application which uses Spring as factory.
   I'm using Struts 2.1 and  Spring 2.5.
 
   The problem is for me that
 - I don't know how to use StrutsTestCase so the created action are
  spring-wired
 - How to make the tests use my /WEB-INF/struts.xml file as Struts
  configuration
 
   Does anybody have this kind of setup working? If yes, are there any
 tricks
  to do that?
 
   Thanks a lot,
   Joachim
 
  -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
 
 




  

Re: Unit testing Struts2 + Spring application?

2008-07-23 Thread Paweł Wielgus
Hi Joachim,
isn't StrutsTestCase for Struts 1.x ?

Best regards,
Paweł Wielgus.

On 23/07/2008, Joachim Ansorg [EMAIL PROTECTED] wrote:
 Hi,
  I'm working on a Struts2 application which uses Spring as factory.
  I'm using Struts 2.1 and  Spring 2.5.

  The problem is for me that
- I don't know how to use StrutsTestCase so the created action are
 spring-wired
- How to make the tests use my /WEB-INF/struts.xml file as Struts
 configuration

  Does anybody have this kind of setup working? If yes, are there any tricks
 to do that?

  Thanks a lot,
  Joachim

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