Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JUnit 3 problem

 
Jerry Van
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thanks,
jv
 
Stevi Deter
Ranch Hand
Posts: 265
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jerry,

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.
 
bart zagers
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Posts: 34672
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to our testing forum.
 
Jerry Van
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!

Cheers,
Jerry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic