You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Atluri Satish <at...@gmail.com> on 2004/10/11 07:37:36 UTC

JCoverage Report always shows 0% Coverage

Hi

I am trying to use JCoverage for a simple project, The JUNIT Test
cases written ensure 100% code-coverage , However the JCoverage report
always shows 0% coverage.
 
I am using Maven 1.0, IBM JDK 1.3.1 Windows 32 build, JCoverage Plugin
1.0.8 and please find Maven & Java files pasted below.

I request your help in letting me know, where and what am I doing wrong.


bye
Satish

********************************************************************************************
                                      M A V E N   F I L E S
*******************************************************************************************
###########################
project.xml file
############################
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<pomVersion>3</pomVersion>
	<id>TestMaven</id>
	<name>TestMaven</name>
	<currentVersion>1.0</currentVersion>
	<organization>
		<name>Test</name>
	</organization>
	<inceptionYear>2004</inceptionYear>


	<!-- Project Build Process -->
	<build>
		<nagEmailAddress>test@test.com</nagEmailAddress>
		<sourceDirectory>${basedir}/src</sourceDirectory>
		<unitTestSourceDirectory>${basedir}/src</unitTestSourceDirectory>
		<!-- Unit Test Cases -->

		<unitTest>
			<includes>
				<include>**/*Test.java</include>
			</includes>
		</unitTest>


	</build>

	<!-- Reports -->
	<reports>
		<report>maven-junit-report-plugin</report>
		<report>maven-jcoverage-plugin</report>
	</reports>
</project>

###########################
project.propeties file
############################
------------------------------------------------------------------------
# xdoc Properties
# ------------------------------------------------------------------------
maven.xdoc.date=left
maven.xdoc.includeProjectDocumentation = yes
maven.xdoc.version=${pom.currentVersion}


#-------------------------------------------------------------------------
# JUNIT Properties
#--------------------------------------------------------------------------
maven.junit.fork=yes
maven.junit.jvmargs=-Xmx512m


#--------------------------------------------------------------------------
# JCoverage Properties
#--------------------------------------------------------------------------
maven.jcoverage.junit.fork=yes
maven.jcoverage.merge.outputDir=${basedir}



********************************************************************************************
                                      J A V A     F I L E S
*******************************************************************************************
###########################
Java Test Fixture
############################

public class TestSubject {
	
	public int add(int a,int b)
	{
	   return a+b;	
	}
	
	
	public int substract(int a,int b)
	{
	   return a-b;	
	}

}

###########################
JUNIT Test Case
############################

import junit.framework.TestCase;
public class TestSubjectTest extends TestCase {

	/**
	 * Constructor for TestSubjectTest.
	 * @param arg0
	 */
	public TestSubjectTest(String arg0) {
		super(arg0);
	}

	public static void main(String[] args) {
		junit.swingui.TestRunner.run(TestSubjectTest.class);
	}

	public void testAdd() {

		TestSubject test = new TestSubject();
		assertEquals(
			"Add Failure",
			new Integer(test.add(5, 2)),
			new Integer(7));
	}



public void testsubstract() {

		TestSubject test = new TestSubject();
		assertEquals(
			"Substration Failure",
			new Integer(test.substract(5, 2)),
			new Integer(3));
	}

}

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


Re: JCoverage Report always shows 0% Coverage

Posted by Brett Porter <br...@gmail.com>.
yes, and that's something I've been meaning to change...


On Mon, 11 Oct 2004 15:09:47 +0900, Shinobu Kawai
<sh...@gmail.com> wrote:
> Hi Brett,
> 
> > The recommended structure is:
> > src/main/java for sources
> > src/test/java for test sources
> Funny, the genapp plugin doesn't do it that way.  :p
> 
> Best regards,
> -- Shinobu Kawai
> 
> --
> Shinobu Kawai <sh...@gmail.com>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
>

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


Re: JCoverage Report always shows 0% Coverage

Posted by Shinobu Kawai <sh...@gmail.com>.
Hi Brett,

> The recommended structure is:
> src/main/java for sources
> src/test/java for test sources
Funny, the genapp plugin doesn't do it that way.  :p

Best regards,
-- Shinobu Kawai

-- 
Shinobu Kawai <sh...@gmail.com>

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


Re: JCoverage Report always shows 0% Coverage

Posted by Brett Porter <br...@gmail.com>.
try putting your source and test source in separate directories. Some
plugins (possibly jcoverage) don't deal well with them in the same
tree.

The recommended structure is:
src/main/java for sources
src/test/java for test sources

- Brett

On Mon, 11 Oct 2004 11:07:36 +0530, Atluri Satish
<at...@gmail.com> wrote:
> Hi
> 
> I am trying to use JCoverage for a simple project, The JUNIT Test
> cases written ensure 100% code-coverage , However the JCoverage report
> always shows 0% coverage.
> 
> I am using Maven 1.0, IBM JDK 1.3.1 Windows 32 build, JCoverage Plugin
> 1.0.8 and please find Maven & Java files pasted below.
> 
> I request your help in letting me know, where and what am I doing wrong.
> 
> bye
> Satish
> 
> ********************************************************************************************
>                                       M A V E N   F I L E S
> *******************************************************************************************
> ###########################
> project.xml file
> ############################
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>         <pomVersion>3</pomVersion>
>         <id>TestMaven</id>
>         <name>TestMaven</name>
>         <currentVersion>1.0</currentVersion>
>         <organization>
>                 <name>Test</name>
>         </organization>
>         <inceptionYear>2004</inceptionYear>
> 
>         <!-- Project Build Process -->
>         <build>
>                 <nagEmailAddress>test@test.com</nagEmailAddress>
>                 <sourceDirectory>${basedir}/src</sourceDirectory>
>                 <unitTestSourceDirectory>${basedir}/src</unitTestSourceDirectory>
>                 <!-- Unit Test Cases -->
> 
>                 <unitTest>
>                         <includes>
>                                 <include>**/*Test.java</include>
>                         </includes>
>                 </unitTest>
> 
>         </build>
> 
>         <!-- Reports -->
>         <reports>
>                 <report>maven-junit-report-plugin</report>
>                 <report>maven-jcoverage-plugin</report>
>         </reports>
> </project>
> 
> ###########################
> project.propeties file
> ############################
> ------------------------------------------------------------------------
> # xdoc Properties
> # ------------------------------------------------------------------------
> maven.xdoc.date=left
> maven.xdoc.includeProjectDocumentation = yes
> maven.xdoc.version=${pom.currentVersion}
> 
> #-------------------------------------------------------------------------
> # JUNIT Properties
> #--------------------------------------------------------------------------
> maven.junit.fork=yes
> maven.junit.jvmargs=-Xmx512m
> 
> #--------------------------------------------------------------------------
> # JCoverage Properties
> #--------------------------------------------------------------------------
> maven.jcoverage.junit.fork=yes
> maven.jcoverage.merge.outputDir=${basedir}
> 
> ********************************************************************************************
>                                       J A V A     F I L E S
> *******************************************************************************************
> ###########################
> Java Test Fixture
> ############################
> 
> public class TestSubject {
> 
>         public int add(int a,int b)
>         {
>            return a+b;
>         }
> 
>         public int substract(int a,int b)
>         {
>            return a-b;
>         }
> 
> }
> 
> ###########################
> JUNIT Test Case
> ############################
> 
> import junit.framework.TestCase;
> public class TestSubjectTest extends TestCase {
> 
>         /**
>          * Constructor for TestSubjectTest.
>          * @param arg0
>          */
>         public TestSubjectTest(String arg0) {
>                 super(arg0);
>         }
> 
>         public static void main(String[] args) {
>                 junit.swingui.TestRunner.run(TestSubjectTest.class);
>         }
> 
>         public void testAdd() {
> 
>                 TestSubject test = new TestSubject();
>                 assertEquals(
>                         "Add Failure",
>                         new Integer(test.add(5, 2)),
>                         new Integer(7));
>         }
> 
> public void testsubstract() {
> 
>                 TestSubject test = new TestSubject();
>                 assertEquals(
>                         "Substration Failure",
>                         new Integer(test.substract(5, 2)),
>                         new Integer(3));
>         }
> 
> }
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
>

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