• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

noobie junit issue

 
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1) My IDE (eclipse) isn't prompting me to run this class as a test.... I'm wondering why ? I've also played with putting
annotations above the methods.

2) In general, if I'm not extending TestCase (due to multiple inheritance prevention), what is the convential way to
make a class Unit Testable ?



I'm not quite sure why....
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jay,
What do you mean by prompting you to run as test? Run as JUnit isn't an option.

Adding annotations to a JUnit 3.8 style doesn't do anything. You need either what you have or to not extend test case and add annotations.
 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eclipse typically offers Run As > JUnit in helios and galileo..... (see image).....

So I guess I'm confused about how / why extension of TestCase is ever necessary.... Is this just an artifact of old JUnit ?
a.jpg
[Thumbnail for a.jpg]
junit (run as) in eclipse.
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

jay vas wrote:Eclipse typically offers Run As > JUnit in helios and galileo..... (see image).....


Right. In Helios, I can run JUnit 4 style tests that way. I don't remember what version of JUnit was built into Galileo.

jay vas wrote:So I guess I'm confused about how / why extension of TestCase is ever necessary.... Is this just an artifact of old JUnit ?


In JUnit 4, you can write tests in the old style or new style. Sometimes, one is using a library that forces extending in the 3.8 style so they kept it as an option.
reply
    Bookmark Topic Watch Topic
  • New Topic