wood burning stoves*
The moose likes Testing and the fly likes more clarification on @beforeclass Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "more clarification on @beforeclass " Watch "more clarification on @beforeclass " New topic
Author

more clarification on @beforeclass

pavan bukka
Greenhorn

Joined: Jan 01, 2013
Posts: 21
hi all,
i am new to junit, i have been told that in @beforeclass we should write code to put data into databse can anybody tell why and how ?

with regards,
bukka pavan.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31069
    
232

@BeforeClass runs once (vs @Before which runs once per test.) More costly operations that can be shared are good to put there. In the case of integration tests, that is common data setup.

Remember to clean up the data in @AfterClass. I also like to have my setup call the teardown first in case the database isn't a good state.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: more clarification on @beforeclass