This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Testing and the fly likes junit program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "junit program" Watch "junit program" New topic

junit program

vijay shanker
Ranch Hand

Joined: Oct 26, 2007
Posts: 88
Hi all,
given below is my program for a simple test case

instead of desired behaviour it is only printing test why? i dont know what to think about this test.

PS;- this is my first program with junit.
Jeanne Boyarsky
internet detective

Joined: May 26, 2003
Posts: 29287

Try removing the " extends TestCase" part. JUnit 3.8 tests extended this. JUnit 4 use annotations. If you use both, JUnit assumes it is a 3.8 test. And in 3.8 tests had to be of the form "public void testXXX".

[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
vijay shanker
Ranch Hand

Joined: Oct 26, 2007
Posts: 88
That is cool i have got the result.
I agree. Here's the link:
subject: junit program
Similar Threads
Junit - inconsitant objects
@After annotation of Junit
JUnit Test
EJB3 testing with JUnit4
How to test a Junit file in eclipse