It's not a secret anymore!*
The moose likes Ant, Maven and Other Build Tools and the fly likes maven and  Junit Tests Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "maven and  Junit Tests" Watch "maven and  Junit Tests" New topic
Author

maven and Junit Tests

Krikor Krumlian
Greenhorn

Joined: Sep 24, 2004
Posts: 9
Hello everyone ,

using maven 1.0.2
and junit 3.8.1
machine MAC OSX

So i am building this project using maven and i have a unit test that i'm trying
to get it to work in maven but so far no luck

my project.xml has this junit dependency defined and nothing else

<!-- Junit for my unit testing -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<type>jar</type>
<properties><war.bundle>false</war.bundle></properties>
</dependency>

as to the build part it goes as follows

<build>

<nagEmailAddress>krikor_krumlian@wgbh.org</nagEmailAddress>

<sourceDirectory>src</sourceDirectory>
<unitTestSourceDirectory>src/test</unitTestSourceDirectory>


<!-- Unit test cases -->
<unitTest>
<includes>
<include>**/*Test*.java</include>
</includes>
</unitTest>

</build>

So now building my app using the command maven test:test
gives me the following

__ __
| \/ |__ _Apache__ ___
| |\/| / _` \ V / -_) ' \ ~ intelligent projects ~
|_| |_\__,_|\_/\___|_||_| v. 1.0.2

build:start:

java repare-filesystem:

java:compile:
[echo] Compiling to /Users/greg/Documents/sprnghibapp/target/classes

java:jar-resources:

test repare-filesystem:

test:test-resources:

test:compile:
[javac] Compiling 1 source files to /Users/greg/Documents/sprnghibapp/target/test-classes

test:test:
[junit] Running KkTest
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
[junit] Testsuite: KkTest
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
[junit]
[junit] Null Test: Caused an ERROR
[junit] KkTest
[junit] java.lang.ClassNotFoundException: KkTest
[junit] at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
[junit] at java.security.AccessController.doPrivileged(Native Method)
[junit] at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
[junit] at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
[junit] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
[junit] at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
[junit] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
[junit] at java.lang.Class.forName0(Native Method)
[junit] at java.lang.Class.forName(Class.java:141)
[junit]

Does anybody know what this is and what the problem is ?
As you realized the test source files are compiling and are being
copied to the target/test-classes which should happen and after that
i get this null thing Any thoughts

Thank you
Kevin Hagel
Greenhorn

Joined: Feb 12, 2003
Posts: 1
Do you have any actual tests within kkTest?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: maven and Junit Tests
 
Similar Threads
maven wsdl2java problem
Maven Error - Package does not exist, Symbols not recognised
SurefireExecutionException
maven dependency runtime
Hibernate Spring Integration problem