File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Testing and the fly likes JUnit 3 problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "JUnit 3 problem" Watch "JUnit 3 problem" New topic

JUnit 3 problem

Jerry Van

Joined: May 03, 2008
Posts: 20
When I run this Junit 3 test class I get the failure "No tests found". However, mt method starts with the "test" word:

So, my question is, what might be causing this failure? Let me know if you need to see any other classes of my LifeGame project.

Stevi Deter
Ranch Hand

Joined: Mar 22, 2008
Posts: 265


Junit 3 tests need to be in the format

Yours has boolean as the return. I suspect that's why Junit doesn't find any test cases.

You should use asserts within the test method to verify the code is working as expected.

There will always be people who are ahead of the curve, and people who are behind the curve. But knowledge moves the curve. --Bill James
bart zagers
Ranch Hand

Joined: Feb 05, 2003
Posts: 234
Yep, that is the problem.
The method should not have a return value (and no arguments).
Also as mentioned, you normally want to test something in your method and therefore use some assert method. In this case it looks like you want to do something like:

Did you read this article on the JUnit website?
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33108

Moving to our testing forum.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Jerry Van

Joined: May 03, 2008
Posts: 20
I apologize for starting this topic in the wrong forum. Thanks for the correction, and thanks to all who replied. By using your replies I got it to work.

Love that java!

I agree. Here's the link:
subject: JUnit 3 problem
It's not a secret anymore!