| Author |
junit test in general
|
mike foulk
Greenhorn
Joined: Jul 12, 2006
Posts: 5
|
|
Need help with JUnit tests. Can some one show me a few assert test examples, I'm so clueless with these things, like assertEquals, and assertNotNull.(please show me how in a beginner level example) things I need to test now are: getting things With SQL and storing them into a collection and returning them.
|
 |
Peter Chase
Ranch Hand
Joined: Oct 30, 2001
Posts: 1970
|
|
Why not STFW before asking? I Googled for "junit test example" and got some good-looking articles on the first page. Searching for "junit test example SQL" revealed some DB-specific stuff. Also, did you try www.junit.org ?
|
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.<br /> <br />#:^P
|
 |
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
|
|
Here's a typical thing: You can also give a comment that will be displayed on failure only: The other assert methods are very similar. assertTrue takes a boolean and fails on false. assertNotNull takes any object and fails on null. It's ok for test methods to throw exception. If an exception indicates an error just let it fly. If you WANT the test subject to throw an exception: STRONG RECOMMENDATION: The Bowling Game Kata is a great example of using JUnit at the center of the programming task. Look for whitepapers and tutorials at JUnit.org, too.
|
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
|
 |
 |
|
|
subject: junit test in general
|
|
|