You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by ji...@codehaus.org on 2004/10/11 21:12:24 UTC

[jira] Created: (MPTEST-44) JUnit fork is not working

Message:

  A new issue has been created in JIRA.

---------------------------------------------------------------------
View the issue:
  http://jira.codehaus.org/browse/MPTEST-44

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: MPTEST-44
    Summary: JUnit fork is not working
       Type: Bug

     Status: Unassigned
   Priority: Major

 Original Estimate: Unknown
 Time Spent: Unknown
  Remaining: Unknown

    Project: maven-test-plugin

   Assignee: 
   Reporter: Thomas Van de Velde

    Created: Mon, 11 Oct 2004 3:11 PM
    Updated: Mon, 11 Oct 2004 3:11 PM
Environment: Windows XP and RedHat 9.0

Description:
According to the test plugin's maven.junit.fork setting, Maven should not fork unit tests by default.  When executing a batch test, it does however fork test classes.  I have created the exact same scenario with ant and with Maven.  Ant loads my static block only once, Maven loads it with each test case.  Her's my test:

TEST CLASSES

public class BaseClass extends TestCase {
	
 static {
 	System.out.println("Loading");
 }

}

public class Class1Test extends BaseClass {
	
	public void testNothing()
	{
		assertEquals(true,true);
	}

}

public class Class2Test extends BaseClass {
	
	public void testNothing()
	{
		assertEquals(true,true);
	}

}

public class Class3Test extends BaseClass {
	
	public void testNothing()
	{
		assertEquals(true,true);
	}

}

==================================================================

ANT

<project default="test">
<target name="test">
	<junit printsummary="yes" haltonfailure="no">
	  <classpath>
	    <pathelement path="bin"/>
	  </classpath>

	  <batchtest fork="no">
	    <fileset dir="src">
	      <include name="**/*Test*.java"/>
	    </fileset>
	  </batchtest>
	</junit>

</target>
</project>

test:
    [junit] Loading
    [junit] Running Class1Test
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,01 sec

    [junit] Running Class2Test
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0 sec

    [junit] Running Class3Test
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0 sec


BUILD SUCCESSFUL

==================================================================

MAVEN

<project>
	<dependencies>
		<dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <type>jar</type>
            <properties/>
        </dependency>
	</dependencies>
    <build>
        <sourceDirectory>${basedir}/src</sourceDirectory>
        <unitTestSourceDirectory>${basedir}/src</unitTestSourceDirectory>
        <unitTest>
            <includes>
                <include>**/*Test.java</include>
            </includes>
        </unitTest>
    </build>
</project>

test:test:
    [junit] Running Class1Test
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,04 sec
Loading
    [junit] Running Class2Test
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,01 sec
Loading
    [junit] Running Class3Test
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,01 sec
BUILD SUCCESSFUL


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[jira] Updated: (MPTEST-44) JUnit fork is not working

Posted by ji...@codehaus.org.
The following issue has been updated:

    Updater: Thomas Van de Velde (mailto:thomas.van.de.velde@accenture.com)
       Date: Mon, 11 Oct 2004 3:14 PM
    Changes:
             Attachment changed to test-fork.zip
    ---------------------------------------------------------------------
For a full history of the issue, see:

  http://jira.codehaus.org/browse/MPTEST-44?page=history

---------------------------------------------------------------------
View the issue:
  http://jira.codehaus.org/browse/MPTEST-44

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: MPTEST-44
    Summary: JUnit fork is not working
       Type: Bug

     Status: Unassigned
   Priority: Major

 Original Estimate: Unknown
 Time Spent: Unknown
  Remaining: Unknown

    Project: maven-test-plugin

   Assignee: 
   Reporter: Thomas Van de Velde

    Created: Mon, 11 Oct 2004 3:11 PM
    Updated: Mon, 11 Oct 2004 3:14 PM
Environment: Windows XP and RedHat 9.0

Description:
According to the test plugin's maven.junit.fork setting, Maven should not fork unit tests by default.  When executing a batch test, it does however fork test classes.  I have created the exact same scenario with ant and with Maven.  Ant loads my static block only once, Maven loads it with each test case.  Her's my test:

TEST CLASSES

public class BaseClass extends TestCase {
	
 static {
 	System.out.println("Loading");
 }

}

public class Class1Test extends BaseClass {
	
	public void testNothing()
	{
		assertEquals(true,true);
	}

}

public class Class2Test extends BaseClass {
	
	public void testNothing()
	{
		assertEquals(true,true);
	}

}

public class Class3Test extends BaseClass {
	
	public void testNothing()
	{
		assertEquals(true,true);
	}

}

==================================================================

ANT

<project default="test">
<target name="test">
	<junit printsummary="yes" haltonfailure="no">
	  <classpath>
	    <pathelement path="bin"/>
	  </classpath>

	  <batchtest fork="no">
	    <fileset dir="src">
	      <include name="**/*Test*.java"/>
	    </fileset>
	  </batchtest>
	</junit>

</target>
</project>

test:
    [junit] Loading
    [junit] Running Class1Test
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,01 sec

    [junit] Running Class2Test
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0 sec

    [junit] Running Class3Test
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0 sec


BUILD SUCCESSFUL

==================================================================

MAVEN

<project>
	<dependencies>
		<dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <type>jar</type>
            <properties/>
        </dependency>
	</dependencies>
    <build>
        <sourceDirectory>${basedir}/src</sourceDirectory>
        <unitTestSourceDirectory>${basedir}/src</unitTestSourceDirectory>
        <unitTest>
            <includes>
                <include>**/*Test.java</include>
            </includes>
        </unitTest>
    </build>
</project>

test:test:
    [junit] Running Class1Test
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,04 sec
Loading
    [junit] Running Class2Test
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,01 sec
Loading
    [junit] Running Class3Test
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,01 sec
BUILD SUCCESSFUL


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[jira] Commented: (MPTEST-44) JUnit fork is not working

Posted by ji...@codehaus.org.
The following comment has been added to this issue:

     Author: Thomas Van de Velde
    Created: Wed, 5 Jan 2005 8:14 AM
       Body:
Is anybody looking into this?

Even changing the plugin code to the exact same thing as in the ant build file does not solve the problem.  I would greatly appreciate it if somebody digs deeper into this.  We are using Spring and Hibernate on a project with hunderds of test cases.  We cannot use Maven for executing the tests since there's no way to cache e.g. the Hibernate session factory.

<goal name="test:test"
	description="Test the application"
	prereqs="test:compile">

	<taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>
	
	<echo>Starting test execution</echo>
	<junit printsummary="yes" haltonfailure="no" failureProperty="maven.test.failure" fork="false">
		<classpath>
	    		<pathelement location="${maven.test.dest}"/>
          		<pathelement location="${maven.build.dest}"/>
          		<path refid="maven.dependency.classpath"/>
	  	</classpath>
	  	<batchtest>
          		<fileset dir="${maven.test.searchdir}">
            			<include name="**/*Test*.java"/>
          		</fileset>
	  	</batchtest>
	</junit>	
</goal>
---------------------------------------------------------------------
View this comment:
  http://jira.codehaus.org/browse/MPTEST-44?page=comments#action_28631

---------------------------------------------------------------------
View the issue:
  http://jira.codehaus.org/browse/MPTEST-44

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: MPTEST-44
    Summary: JUnit fork is not working
       Type: Bug

     Status: Unassigned
   Priority: Major

 Original Estimate: Unknown
 Time Spent: Unknown
  Remaining: Unknown

    Project: maven-test-plugin

   Assignee: 
   Reporter: Thomas Van de Velde

    Created: Mon, 11 Oct 2004 3:11 PM
    Updated: Wed, 5 Jan 2005 8:14 AM
Environment: Windows XP and RedHat 9.0

Description:
According to the test plugin's maven.junit.fork setting, Maven should not fork unit tests by default.  When executing a batch test, it does however fork test classes.  I have created the exact same scenario with ant and with Maven.  Ant loads my static block only once, Maven loads it with each test case.  Her's my test:

TEST CLASSES

public class BaseClass extends TestCase {
	
 static {
 	System.out.println("Loading");
 }

}

public class Class1Test extends BaseClass {
	
	public void testNothing()
	{
		assertEquals(true,true);
	}

}

public class Class2Test extends BaseClass {
	
	public void testNothing()
	{
		assertEquals(true,true);
	}

}

public class Class3Test extends BaseClass {
	
	public void testNothing()
	{
		assertEquals(true,true);
	}

}

==================================================================

ANT

<project default="test">
<target name="test">
	<junit printsummary="yes" haltonfailure="no">
	  <classpath>
	    <pathelement path="bin"/>
	  </classpath>

	  <batchtest fork="no">
	    <fileset dir="src">
	      <include name="**/*Test*.java"/>
	    </fileset>
	  </batchtest>
	</junit>

</target>
</project>

test:
    [junit] Loading
    [junit] Running Class1Test
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,01 sec

    [junit] Running Class2Test
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0 sec

    [junit] Running Class3Test
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0 sec


BUILD SUCCESSFUL

==================================================================

MAVEN

<project>
	<dependencies>
		<dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <type>jar</type>
            <properties/>
        </dependency>
	</dependencies>
    <build>
        <sourceDirectory>${basedir}/src</sourceDirectory>
        <unitTestSourceDirectory>${basedir}/src</unitTestSourceDirectory>
        <unitTest>
            <includes>
                <include>**/*Test.java</include>
            </includes>
        </unitTest>
    </build>
</project>

test:test:
    [junit] Running Class1Test
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,04 sec
Loading
    [junit] Running Class2Test
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,01 sec
Loading
    [junit] Running Class3Test
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,01 sec
BUILD SUCCESSFUL


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[jira] Closed: (MPTEST-44) JUnit fork is not working

Posted by ji...@codehaus.org.
Message:

   The following issue has been closed.

   Resolver: Brett Porter
       Date: Fri, 7 Jan 2005 6:42 PM

honestly, I can't explain why this happens (probably differences in the classloader), but can assure you that it is not forking a new JVM for each instance. Run maven -X test, and then maven -X -Dmaven.junit.fork=yes and notice the difference.
---------------------------------------------------------------------
View the issue:
  http://jira.codehaus.org/browse/MPTEST-44

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: MPTEST-44
    Summary: JUnit fork is not working
       Type: Bug

     Status: Closed
   Priority: Major
 Resolution: INCOMPLETE

 Original Estimate: Unknown
 Time Spent: Unknown
  Remaining: Unknown

    Project: maven-test-plugin

   Assignee: 
   Reporter: Thomas Van de Velde

    Created: Mon, 11 Oct 2004 3:11 PM
    Updated: Fri, 7 Jan 2005 6:42 PM
Environment: Windows XP and RedHat 9.0

Description:
According to the test plugin's maven.junit.fork setting, Maven should not fork unit tests by default.  When executing a batch test, it does however fork test classes.  I have created the exact same scenario with ant and with Maven.  Ant loads my static block only once, Maven loads it with each test case.  Her's my test:

TEST CLASSES

public class BaseClass extends TestCase {
	
 static {
 	System.out.println("Loading");
 }

}

public class Class1Test extends BaseClass {
	
	public void testNothing()
	{
		assertEquals(true,true);
	}

}

public class Class2Test extends BaseClass {
	
	public void testNothing()
	{
		assertEquals(true,true);
	}

}

public class Class3Test extends BaseClass {
	
	public void testNothing()
	{
		assertEquals(true,true);
	}

}

==================================================================

ANT

<project default="test">
<target name="test">
	<junit printsummary="yes" haltonfailure="no">
	  <classpath>
	    <pathelement path="bin"/>
	  </classpath>

	  <batchtest fork="no">
	    <fileset dir="src">
	      <include name="**/*Test*.java"/>
	    </fileset>
	  </batchtest>
	</junit>

</target>
</project>

test:
    [junit] Loading
    [junit] Running Class1Test
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,01 sec

    [junit] Running Class2Test
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0 sec

    [junit] Running Class3Test
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0 sec


BUILD SUCCESSFUL

==================================================================

MAVEN

<project>
	<dependencies>
		<dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <type>jar</type>
            <properties/>
        </dependency>
	</dependencies>
    <build>
        <sourceDirectory>${basedir}/src</sourceDirectory>
        <unitTestSourceDirectory>${basedir}/src</unitTestSourceDirectory>
        <unitTest>
            <includes>
                <include>**/*Test.java</include>
            </includes>
        </unitTest>
    </build>
</project>

test:test:
    [junit] Running Class1Test
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,04 sec
Loading
    [junit] Running Class2Test
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,01 sec
Loading
    [junit] Running Class3Test
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,01 sec
BUILD SUCCESSFUL


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org