• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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.
 
Check your pockets for water buffalo. You might need to use this tiny ad until locate a water buffalo:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic