• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setup - JUnit and Eclipse

 
Garrett Smith
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have JUnit set up with Eclipse. But my test won't run.


It's pretty darn simple. How come it won't work? I'm using JUnit 4 included with Eclipse.

It says <terminated> above the console.
 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why do you call it a test?
 
Garrett Smith
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to test that I can test.

But I cannot
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34860
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Garrett,
What version of Eclipse are you using?

I'm moving this to the IDEs forum, since the unit test itself is fine.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18277
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've not seen JUnit done with annotations. The traditional convention is that you make a class that parallels the class name to be tested and name it "classnameTest", using the original class name as the value of "classname" and making it a subclass of a JUnit base class. Then Eclipse can run it via a right-click menu option.
 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pardon my ignorance, pls
@ Jeanne Boyarsky
why do you consider that code an unit test?
because of the @test anotation??
ty
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34860
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Miguel,
JUnit 4 supports annotations instead of having to extend TestCase. I don't know if the IDEs are up to it though.
 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ty, Jeanne
i was shocked when i (re)visited junit site, but then i understood: anotations means junit4, while all i knew about was plain old 3 version
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Garrett, in my Eclipse 3.2 that test class works just fine (as long as you add the JUnit 4 .jar file to the project's classpath).

How are you trying to run it?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic