aspose file tools*
The moose likes Testing and the fly likes planning test data and doing negative testing with junit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "planning test data and doing negative testing with junit" Watch "planning test data and doing negative testing with junit" New topic
Author

planning test data and doing negative testing with junit

sushil bharwani
Greenhorn

Joined: Mar 02, 2006
Posts: 26
How is test data planned and how is negative testing done do we create some test database

Thanks
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
The short answer is that JUnit testing is usually done without a database as you want these tests to be atomic, easy to set up and fast to execute. I use EasyMock to mock out objects which make calls outside my application, eg database, web service, legacy system.

When you subsequently do system, integration or user acceptance testing, you will need a test database.


SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30309
    
150

We use JUnit for both our unit tests and integration tests. The unit tests work as Roger described.

For the integration tests, we do access the database. For static data, we rely on the database being in a known state. For dynamic data, we insert it as the first step in our suite and delete it as the last step.

The actual test data is planned based on what business scenarios we want to test and what alternate/error paths can occur. We also look at what unexpected inputs can be passed in. These cover the negative testing cases.


[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: planning test data and doing negative testing with junit