• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

noobie junit issue

 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
  • 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....
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
378
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • 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
Marshal
Posts: 34973
378
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic