Standard set of unit tests for data layer code



  • While designing test cases for an application's database code (the data layer), I would like to determine a good subset of tests to run in order to guarantee its proper function. In essence, the goal would be to come up with the smallest set of tests that can provide the best guarantee possible of its function.

    Probably, the set of tests includes simple operations (INSERT, UPDATE, DELETE, etc.) as well as certain combinations of operations that should work (INSERT then SELECT, or DELETE then SELECT). It is this set of combinations that is non-trivial and of greatest interest here.

    Is there a standard or best-practice set of tests that is defined for database operations? Where should I look for something like that?

    Thanks very much!



  • From application perspective you need to look at below states for DB to be validated with basic cases

    • Clean up Scripts (Clearing Previous Run Data)
    • Initial Data population (From a fresh install whatever initial configuration you need to do)
    • Prerequisites Validations Tests (Checklist to validate before you start run - Services up / DB's accessible, able to connect to DB's with supplied credentials)
    • Run Tests (These are actual test you can run to validate, ex- calling of storedprocs with test data, updating few job tables in DB to process populated data etc..)

    This provides a logical flow as well help you re-run every time.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2