Re: surefire 2.2 + JUnit4?

2006-06-01 Thread shoening

Hi all,

what you might also do is to write your testcases the JUnit 4 way 
(whithout a suite() method,
without extending TestCase, without having your test methods named with 
the "test" prefix)
and then write an additional class (which you simply can throw away in 
the future)
which extends junit.framework.TestCase and provides a suite() method 
returning

a JUnit4TestAdapter instance.

Yours
Stefan


-Original Message-
From: Cheng-Yang Tang <[EMAIL PROTECTED]>
To: Maven Users List 
Sent: Sat, 20 May 2006 13:44:14 +0100
Subject: RE: surefire 2.2 + JUnit4?

 Hi Daun,

Thanks for your detailed explaination.
And yes, when I wrote the unit test in JUnit v3.8.1 way
everything works as expected.
Thanks very much

Louis


-Original Message-
From: Daun DeFrance [mailto:[EMAIL PROTECTED]
Sent: Fri 19/05/2006 17:01
To: Maven Users List
Subject: RE: surefire 2.2 + JUnit4?

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]



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


___
Try the New Netscape Mail Today!
Virtually Spam-Free | More Storage | Import Your Contact List
http://mail.netscape.com


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



Re : log within surefire 2.2

2006-05-28 Thread langlois yan
Can we discribe surefire plugin in the pom to tell him where is the 
configuration file. Or, is it a missing feature ?

Yan.

- Message d'origine 
De : Wim Deblauwe <[EMAIL PROTECTED]>
À : Maven Users List 
Envoyé le : Dimanche, 28 Mai 2006, 2h12mn 24s
Objet : Re: log within surefire 2.2

It was through searching I got the below mail, but I saw it is unanswered,
hence my mail...

I hope someone can help us out...

regards,

Wim

2006/5/27, Andreas Guther <[EMAIL PROTECTED]>:
>
> Did you search the mailing list archive?  I think I read not too long
> ago a thread on that issue with a similar problem.
>
> Andreas
>
>
>
> -Original Message-
> From: Wim Deblauwe [mailto:[EMAIL PROTECTED]
> Sent: Saturday, May 27, 2006 11:36 AM
> To: Maven Users List; langlois yan
> Subject: Re: log within surefire 2.2
>
> I got the same problem, anyone got a solution for this?
>
> 2006/5/16, langlois yan <[EMAIL PROTECTED]>:
> >
> > The new release of the surefire plugin does not use my log4j which is
> in
> > the src/main/resources. How can I tell surefire to use it ?
> >
> > Yan.
> >
> >
> >
> > -
> > 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]



Re: log within surefire 2.2

2006-05-28 Thread Wim Deblauwe

It was through searching I got the below mail, but I saw it is unanswered,
hence my mail...

I hope someone can help us out...

regards,

Wim

2006/5/27, Andreas Guther <[EMAIL PROTECTED]>:


Did you search the mailing list archive?  I think I read not too long
ago a thread on that issue with a similar problem.

Andreas



-Original Message-
From: Wim Deblauwe [mailto:[EMAIL PROTECTED]
Sent: Saturday, May 27, 2006 11:36 AM
To: Maven Users List; langlois yan
Subject: Re: log within surefire 2.2

I got the same problem, anyone got a solution for this?

2006/5/16, langlois yan <[EMAIL PROTECTED]>:
>
> The new release of the surefire plugin does not use my log4j which is
in
> the src/main/resources. How can I tell surefire to use it ?
>
> Yan.
>
>
>
> -
> 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]




RE: log within surefire 2.2

2006-05-27 Thread Andreas Guther
Did you search the mailing list archive?  I think I read not too long
ago a thread on that issue with a similar problem.

Andreas



-Original Message-
From: Wim Deblauwe [mailto:[EMAIL PROTECTED] 
Sent: Saturday, May 27, 2006 11:36 AM
To: Maven Users List; langlois yan
Subject: Re: log within surefire 2.2

I got the same problem, anyone got a solution for this?

2006/5/16, langlois yan <[EMAIL PROTECTED]>:
>
> The new release of the surefire plugin does not use my log4j which is
in
> the src/main/resources. How can I tell surefire to use it ?
>
> Yan.
>
>
>
> -
> 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]



Re: log within surefire 2.2

2006-05-27 Thread Wim Deblauwe

I got the same problem, anyone got a solution for this?

2006/5/16, langlois yan <[EMAIL PROTECTED]>:


The new release of the surefire plugin does not use my log4j which is in
the src/main/resources. How can I tell surefire to use it ?

Yan.



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




RE: Surefire-2.2-SNAPSHOT and UnsupportedClassVersionError - more info

2006-05-24 Thread Adam Hardy
When I run 'mvn test', I get a stacktrace from the surefire-booter
saying UnsupportedClassVersionError as follows.  This is a recap of my
minimal project which I'm going to use as the base for a bug in jira.

[INFO] Surefire report directory:
C:\Projects\cortex\back-end\target\surefire-reports
org.apache.maven.surefire.booter.SurefireExecutionException:
com/cortex/base/domain/card/CardFinderTest (Unsupported major.minor
version 49.0); 
nested except is java.lang.UnsupportedClassVersionError: 
com/cortex/base/domain/card/CardFinderTest (Unsupported major.minor
version 49.0)
java.lang.UnsupportedClassVersionError:
com/cortex/base/domain/card/CardFinderTest 
(Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at
org.apache.maven.surefire.booter.IsolatedClassLoader.loadClass(IsolatedC
lassLoader.java:88)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.locateTestSet
s(AbstractDirect...
at
org.apache.maven.surefire.Surefire.createSuiteFromDefinition(Surefire.ja
va:147)
at org.apache.maven.surefire.Surefire.run(Surefire.java:108)
at java.lang.reflect.Method.invoke(Native Method)
at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(Suref
ireBooter.java:220)
at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java
:733)

I have JDK1.5.0_06 as my JAVA_HOME and this is the compiler plugin
config:

  
org.apache.maven.plugins
maven-compiler-plugin

  1.5
  1.5

  

I started with clean code base, checked for stray .class files, and the
local repository is empty. I specified the following for my remote
repositories:

   
  
 apache.snapshots
 http://cvs.apache.org/maven-snapshot-repository
  
   
   
  
   apache.snapshots
   http://cvs.apache.org/maven-snapshot-repository
 
   

I specified the latest maven-surefire-plugin-2.2-SNAPSHOT

  
org.apache.maven.plugins
maven-surefire-plugin
2.2-SNAPSHOT
  

And I can see the maven downloads the snapshots for
maven-surefire-plugin-2.2 (2.2-20060507.223157-4) and
surefire-2.0. It is using   2.0-20060507.230910-3 for
surefire-booter, surefire-api, surefire-junit and surefire-providers.

I have an associate (Marco) for whom this set-up works, so I assume that
he has earlier versions of the jars. 

My next step is to try to run it with those versions, and if that
doesn't work, to compile from source. 

Failing that, and if there is no more help available on the list or as a
result of this new jira issue, I may have to contact the developers
mentioned in the poms. 

Thanks
Adam


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



RE: surefire 2.2 + JUnit4?

2006-05-20 Thread Cheng-Yang Tang
Hi Daun,

Thanks for your detailed explaination.
And yes, when I wrote the unit test in JUnit v3.8.1 way
everything works as expected.
Thanks very much

Louis


-Original Message-
From: Daun DeFrance [mailto:[EMAIL PROTECTED]
Sent: Fri 19/05/2006 17:01
To: Maven Users List
Subject: RE: surefire 2.2 + JUnit4?
 
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]



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



RE: surefire 2.2 + JUnit4?

2006-05-19 Thread Daun DeFrance
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]



RE: surefire 2.2 + JUnit4?

2006-05-19 Thread Cheng-Yang Tang
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]



surefire 2.2

2006-05-18 Thread Davis Ford

Hi just wondering if the group has experimented with the new surefire
2.2 plugin release, and if it does indeed solve the GC issue Brett
indicates below.  We are seeing this issue, and looking to update the
plugin, but getting by with feeding arguments to the jvm for now.

Regards,
Davis



FYI, the upcoming 2.2 release of surefire will reduce the memory used
by allowing the test cases to be garbage collected after they've run
instead of at the end. It also enables assertions by default, whether
you are forking or not, by setting the flag on the classloader running
the tests.

- Brett


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



Re: surefire 2.2 + JUnit4?

2006-05-18 Thread Jeffrey D. Brekke
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]



surefire 2.2 + JUnit4?

2006-05-18 Thread Cheng-Yang Tang
Hi,

I know the issue about how to use JUnit4 in Maven2 has been discussed for a 
while.
But the adapter method:

  public static junit.framework.Test suite() {
return new JUnit4TestAdapter(SimpleTest.class);
  }

doesn't help much in my case.
I've heard that surefire2.2 may amend this.
However, after upgrading to sruefire2.2, this problem remains.
the test code are listed follow, which passed the JUnit test when I run it 
manually without maven
Can anyone help me with that?

Thanks in advance.

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(WebServiceDispatcher.class);
}
}

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



log within surefire 2.2

2006-05-16 Thread langlois yan
The new release of the surefire plugin does not use my log4j which is in the 
src/main/resources. How can I tell surefire to use it ?

Yan.



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