Hi ,

I am using Maven for the first time for 'Unit Testing'. I am not very clear about how 
it exactly works.
As far as I know, Maven has a in built plugin for JUnit and we need to provide the 
<unitTestSourceDirectory>
in Project.xml. However if for,e.g., SampleTest.java is expected to test 
SampleMaven.java, then how the individual methods are going to be tested ? How are we 
going to pass the parameters ? shall we call every method individually ?

I am sorry for asking such a basic question but I have never worked in this regard.
I tried to use Unit testing feature but getting some errors as below:

test:test-resources:

test:compile:
    [javac] Compiling 1 source file to D:\SampleMaven\target\test-classes

test:test:
    [junit] dir attribute ignored if running in the same VM
    [junit] Running MavenTest
    [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
    [junit] [ERROR] TEST MavenTest FAILED

BUILD FAILED
File...... file:/C:/Documents and Settings/104487/.maven/plugins/maven-test-plug
in-1.3/
Element... fail
Line...... 99
Column.... 54
There were test failures.
Total time:  21 seconds

Log under 'testreports' says :
java.lang.ClassNotFoundException: MavenTest
        at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:186)


Attached with this is my Project.xml, Source and Test files.



Thanks a lot in advance,
Yogesh



<?xml version="1.0"?>
<project>
  <pomVersion>3</pomVersion>
  <name>SampleMaven Documentation</name>
  <id>MavenJar</id>
<groupId>Plain Java</groupId>
  
  <currentVersion>007</currentVersion>
  
  
  <organization>
    <name>Cognizant Technology Solutions</name>
    <url>http://www.cognizant.com</url>
  </organization>

    <organization>
      <name>Yogesh Joshi</name>
      <url>http://www.cognizant.com/</url>
      
  <logo>logo_cts.gif</logo>
    </organization>
  
    <!-- (OPTIONAL) Year of inception -->
    <inceptionYear>2003</inceptionYear>
  
    <!-- (OPTIONAL) Project main package -->
    <package>sample</package>

  <!-- (OPTIONAL) Project logo picture (URL) -->
  <logo>http://w3.markers.com/logo/crayola.gif</logo>

  <!-- (OPTIONAL) Project description -->
  <description>This is Maven for the first time :)</description>

  
  <shortDescription>Java Project Management Tools</shortDescription>


  <!-- (OPTIONAL) Project site URL -->
  <url>http://www.cognizant.com</url>


  <!-- (OPTIONAL) Issue-tracking system URL -->
  
<issueTrackingUrl>http://w3.markers.com/jira/crayola</issueTrackingUrl>

  <!-- (OPTIONAL) Project site address. -->
  <siteAddress>http://www.cognizant.com</siteAddress>

  <!-- (OPTIONAL) Project-site deploy directory (physical location) -->
  <siteDirectory>/www/crayola/site/</siteDirectory>

  <!-- (OPTIONAL) Project distribution directory (physical location) -->
  
<distributionDirectory>/www/crayola/builds/</distributionDirectory>

  <!-- (OPTIONAL) Project source-repository information -->
  <repository>
    
    
    
	<target name="personal" depends="init">
	     <vssget vsspath="/construction/src_metllife/"
	             localPath="D:\metlife\construction\"
	             ssdir="C:\Program Files\Microsoft Visual Studio\Common\VSS\win32"
		     recursive="true" 
		     login="105500,105500"
		     serverPath="\\ctsinpunvss\metlife\"
		     autoresponse="Y"
		     writable="true"/>
	   </target>
    
    
    
<connection>
scm:cvs:pserver:[EMAIL PROTECTED]:/home/cvspublic:crayola
</connection>
    <url>http://cvs.markers.com/viewcvs/crayola/</url>
  </repository>

  <description>
    Maven is a project management and project comprehension
    tool. Maven is based on the concept of a project object
    model: builds, documentation creation, site publication,
    and distribution publication are all controlled from the
    project object model. Maven also provides tools to
    create source metrics, change logs based directly on
    source repository, and source cross-references.
  </description>


  <versions>
    <version>
      <id>111</id>
      <name>Alpha</name>
      <tag>MAVEN_1_0_B3</tag>
    </version>
    <version>
      <id>222</id>
      <name>Beta</name>
      <tag>HEAD</tag>
    </version>
  </versions>


  <mailingLists>
    <mailingList>
      <name>Maven User List</name>
      <subscribe>
        [EMAIL PROTECTED]
      </subscribe>
      <unsubscribe>
        [EMAIL PROTECTED]
      </unsubscribe>
      <archive>
        http://www.mail-archive.com/[EMAIL PROTECTED]/
      </archive>
    </mailingList>
  </mailingLists>

  <developers>

    <developer>
      <name>Juancarlo Anez</name>
      <id>juanco</id>
      <email>[EMAIL PROTECTED]</email>
      <organization></organization>
    </developer>

    <developer>
      <name>Yogesh Joshi</name>
      <id>yogesh</id>
      <email>[EMAIL PROTECTED]</email>
      <organization></organization>
    </developer>    
  </developers>
  
  


  <dependencies>

    <!-- This project depends on the JAR file "commons-beanutils-1.5.jar"
          in the Maven repository's commons-beanutils/jars subdirectory
          (more about repository later). -->
    <dependency>
      <groupId>commons-beanutils</groupId>
      <artifactId>commons-beanutils</artifactId>
      <version>1.5</version>
    </dependency>
    <!-- This project depends on the JAR file "commons-lib-2.1.jar" in
          the Maven repository's markers/jars subdirectory. -->
<!--    <dependency>
      <groupId>markers</groupId>
      <artifactId>commons-lib</artifactId>
      <version>2.1</version>
    </dependency>
-->

  </dependencies>


  
  <build>

    <nagEmailAddress>
      [EMAIL PROTECTED]
    </nagEmailAddress>




    <sourceDirectory>D:\SampleMaven\com\src\java\sample</sourceDirectory>

<unitTestSourceDirectory>D:\SampleMaven\com\src\test</unitTestSourceDirectory>

    <!-- (OPTIONAL) Unit test-case file pattern. -->
    <unitTest>
      <includes>
        <include>*Test.java</include>
      </includes>
    </unitTest>



    <aspectSourceDirectory/>

             

    <!-- Integration unit test cases -->
    <integrationUnitTest/>

    <jars>
    </jars>
  </build>
</project>

This e-mail and any files transmitted with it are for the sole use of the intended 
recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient, please contact the sender by reply e-mail and 
destroy all copies of the original message. Any unauthorised review, use, disclosure, 
dissemination, forwarding, printing or copying of this email or any action taken in 
reliance on this e-mail is strictly prohibited and may be unlawful.
Visit us at http://www.cognizant.com

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

Reply via email to