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 OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "maven and  Junit Tests" Watch "maven and  Junit Tests" New topic

maven and Junit Tests

Krikor Krumlian

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 -->

as to the build part it goes as follows




<!-- Unit test cases -->


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

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


java repare-filesystem:

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


test repare-filesystem:


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

[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] Null Test: Caused an ERROR
[junit] KkTest
[junit] java.lang.ClassNotFoundException: KkTest
[junit] at$
[junit] at Method)
[junit] at
[junit] at java.lang.ClassLoader.loadClass(
[junit] at sun.misc.Launcher$AppClassLoader.loadClass(
[junit] at java.lang.ClassLoader.loadClass(
[junit] at java.lang.ClassLoader.loadClassInternal(
[junit] at java.lang.Class.forName0(Native Method)
[junit] at java.lang.Class.forName(

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

Joined: Feb 12, 2003
Posts: 1
Do you have any actual tests within kkTest?
I agree. Here's the link:
subject: maven and Junit Tests
It's not a secret anymore!