• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

maven and Junit Tests

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you have any actual tests within kkTest?
reply
    Bookmark Topic Watch Topic
  • New Topic