• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

JUnit - Few beginner questions

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I planning to use JUnit 3.x plugin in Eclipse 3.1 for white box testing.
Are there some guidelines to be followed while writing JUnit tests?
I came across this. But the article seems pretty old. Is it pertinent even today?
Is JUnit 4.x way more better than JUnit3.x?What are the pros and cons? I think JUnit 4.x doesn't give a GUI based output in Eclipse.
I have read about @BeforeClass and @AfterClass annotations.Is there an equivalent mechanism in JUnit 3.x.
And I couldn't figure out how am I going to test for expected output when I am working on a database system?
 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
only major guideline i can suggest that people dont follow right away is to test actions and not methods. for example if your testing involves a database try focusing your testing on behavior (like testing the select process) vs testing specific methods (like testing getters and setters). you can throw asserts anywhere but try to keep your tests focused on the behaviors your code is going to have to do.
 
K Aditi
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Amaru. Will keep that in mind.
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eclipse has full JUnit 4 support. The only valid reason I could imagine for using JUnit 3 these days is having to use a Java version before 1.5.
 
I am Arthur, King of the Britons. And this is a tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic