wood burning stoves*
The moose likes Websphere and the fly likes call a JUnit test from another class ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "call a JUnit test from another class ? " Watch "call a JUnit test from another class ? " New topic

call a JUnit test from another class ?

David Coulthard

Joined: Apr 16, 2008
Posts: 16
I'm using Rad 6. I have test cases written for some of the programs in the test package. I want to write a java program in some other package to trigger the JUnit test. Is it possible ?

(what im trying is to have a jsp page that can select the exact test to run from a drop down, pass it to a java class in another package, and this java class has to trigger that exact JUnit test)

I tried it and am getting the following error.

Error 500: Error while defining class: com.macys.ps.parms.comm.test.allMessagesTest This error indicates that the class: junit.framework.TestCase could not be located while defining the class: com.macys.ps.parms.comm.test.allMessagesTest This is often caused by having the class at a higher point in the classloader hierarchy Dumping the current context classloader hierarchy: ==> indicates defining classloader *** indicates classloader where the missing class could have been found ==>[0] com.ibm.ws.classloader.CompoundClassLoader@4a9e9ce7
David Coulthard

Joined: Apr 16, 2008
Posts: 16
I hope i have posted it in the right place .. Im new here and I dont know where to post for JUnit related questions. thanks.
Jeanne Boyarsky
internet detective

Joined: May 26, 2003
Posts: 30050

Where is JUnit.jar? In the ear? war? somewhere else?

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
David Coulthard

Joined: Apr 16, 2008
Posts: 16
got it figured out .... I had added JUnit to my project classpath but apparently that was not enough.... silly me ! I copied the jar file and placed it in my library and it works now !
I agree. Here's the link: http://aspose.com/file-tools
subject: call a JUnit test from another class ?
Similar Threads
ClassLoader Hierarchy Issues in RAD 7
Calling Junit from another java class ?
Classloader problem?
Exception while connecting to DB2 from Hibernate with RAD 7
Failed to load servlet. Easy for you! Help me please!