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

planning test data and doing negative testing with junit

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How is test data planned and how is negative testing done do we create some test database

Thanks
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic