Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

problem in running JUnit Test

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
When I am doing my unit testing it is giving me class not found exception.
I have checked for all classpaths but mystery remains same.
can anybody tell me this?
here is my program--
package com.comput.Das;
import junit.framework.*;
import junit.extensions.*;
import com.ZTC_Das;
public class UnitJ extends TestCase{
public UnitJ(String arg1){
super(arg1);
}
public static void main(String ar[]){
junit.textui.TestRunner.run(suite());
}
public static UnitJ suite(){
return new UnitJ("com.ZTC_Das.class");
}
public void testString() {
try {
ZTC_Das objDML = new ZTC_Das();
String in="Hello World";
assertEquals("Hello World ",objDML.elxModifyString(in));
} catch(Exception ex){
System.out.println("Error Message="+ex);
}
}
}
Thanx in advance
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Like, what class not found?
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I feel that you are writing the suite() method wrongly.
regds,
Parag
 
Jack Nicholson
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am getting error as ZTC_Das.class not found.
& I have tried suite() method in both ways like
public static UnitJ suite(){
return new UnitJ("ZTC_Das.class");
}
& also
public static UnitJ suite(){
return new UnitJ("com.ZTC_Das.class");
}
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This works:

Maybe you can replace my class AAA with your whatsit.
Best way to learn about something is to fumble with someoneelse's problematic code...
 
Jack Nicholson
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanx Barry
 
I think I'll just lie down here for a second. And ponder this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic