Louis, The only way I could get my JUnit4 tests to run is if they looked and smelled like 3.8.1.
That is, my test had to extend TestCase (which overloads the static import of Assert.*) and all my test methods had to begin with "test". I also had the suite() method as you did below. With the proper JUnit4 dependency, my annotations and such compiled, but having to make my JUnit4 test look like 3.8.1 eliminates all the benefits of writing v4 tests that will run in maven. I downloaded the source for Surefire (trunk) and the junit provider is pretty hardcoded to be 3.8.1. Well it looks for 3.8.1 syntax to determine which tests to run. Until it is refactored to support JUnit 4 syntax, I don't think there's a real workaround (short of what I mentioned above) to get it to work. Does anyone have an idea on when this might be? Best, Daun -----Original Message----- From: Cheng-Yang Tang [mailto:[EMAIL PROTECTED] Sent: Friday, May 19, 2006 4:39 AM To: Maven Users List; Maven Users List Subject: RE: surefire 2.2 + JUnit4? I tried to modified the variable names so that those who willing to help me out can understand my problem a bit easier. But it seems I missed this one. Thanks for reminding me that. the "correct problem code" should be as you pointed out (listed below). But it still doesn't work as expected. Louis import org.junit.*; import static org.junit.Assert.*; import junit.framework.JUnit4TestAdapter; public class MyTest { private int i; @Before public void runOnceBeforeAllTests() { i = 10; } @Test public void test4() { assertEquals(10, i); } public static junit.framework.Test suite() { return new JUnit4TestAdapter(MyTest.class); } } -----Original Message----- From: Jeffrey D. Brekke [mailto:[EMAIL PROTECTED] Sent: Fri 19/05/2006 02:59 To: Maven Users List Subject: Re: surefire 2.2 + JUnit4? I don't know much about surefire, but it looks like the adapter is pointing to the incorrect class? Should be MyTest.class? Cheng-Yang Tang wrote: [SNIPPED] > import org.junit.*; > import static org.junit.Assert.*; > import junit.framework.JUnit4TestAdapter; > > public class MyTest { > > private int i; > > @Before public void runOnceBeforeAllTests() > { > i = 10; > } > > @Test public void test4() > { > assertEquals(10, i); > } > > public static junit.framework.Test suite() > { > return new JUnit4TestAdapter(WebServiceDispatcher.class); > } > } -- ===================================================================== Jeffrey D. Brekke [EMAIL PROTECTED] Wisconsin, USA [EMAIL PROTECTED] [EMAIL PROTECTED] http://www.bloglines.com/blog/jbrekke [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
