• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

planning test data and doing negative testing with junit

 
sushil bharwani
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How is test data planned and how is negative testing done do we create some test database

Thanks
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34669
366
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic