Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to test a Junit file in eclipse

 
Rajesh Khan
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i created a junit test file of the class that i want to test. I wanted to know now how i can run that test ?? Example this was the class that was generated by eclipse

 
Rajesh Khan
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Junit Test
warning(org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader$1)
 
Manoj Kumar Jain
Ranch Hand
Posts: 198
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Junits classes extends TestCase class and you have to put the Junit jar in the library also.

You can just run the test cases by right click >Run As>Junit Test.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Manoj Kumar Jain wrote:Junits classes extends TestCase class

That is only true before JUnit 4. In JUnit 4, you can use annotations to identify test classes and methods.

@Rajesh: as it stands, you have not written a unit test - none of the methods are annotated.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic