This week's book / license giveaways are in the JDBC and Relational Databases and Java in General forums.
We're giving away four copies each of PostGIS in Action and Java Advanced Topics Training and have the authors on-line!
See this thread and this one for details.
The moose likes Testing and the fly likes noobie junit issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » Testing
Bookmark "noobie junit issue" Watch "noobie junit issue" New topic
Author

noobie junit issue

jay vas
Ranch Hand

Joined: Aug 30, 2005
Posts: 407
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

Joined: May 26, 2003
Posts: 31798
    
192

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.


[OCA 8 book] [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
jay vas
Ranch Hand

Joined: Aug 30, 2005
Posts: 407
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 ?



[Thumbnail for a.jpg]

Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31798
    
192

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: noobie junit issue