views:

54

answers:

2

Currently doing a test plan for a system. May I know what are the ways to test a database? How do I test whether the database is a good database? And how do I stress test a database?

+1  A: 

As far as stress-testing, you can start with MySQL's load-testing tool, called mysqlslap. See documentation for details.

As for the rest, any type of functional testing is a validation step that tests that your system does things it's supposed to do, and doesn't do things it's not supposed to do.

For example:

  • Do the tables exist, with columns as you expect them to?
  • Are tables designed in normal form, unless there are specific exception cases?
  • Do the data types of these columns allow the range of values you need to store?
  • Do the constraints disallow invalid data where appropriate, e.g. unique constraints, foreign key constraints, check constraints
  • If you use stored procedures, can you test that they do what you expect, given various parameter values, and given various database starting states?
  • If you have developed data access objects (DAOs), can you unit-test that code to make sure it does what you intend with various inputs and given various database starting states?

You can also test for performance, and use this as a guide for optimizing the database. See my presentation MENTOR Your Indexes.

The first step for designing a Quality Control (QC) plan is to define the requirements, and make sure these requirements can be tested for. That is, state them in terms of things that can be measured.

"Good" cannot be measured.

Bill Karwin
+3  A: 

You really really really need to know what your boss wants you to do. When you say:

'not really sure of the purpose. i was asked by my boss to include database testing in my test plan. so i guess is just plain performance test. :)'

That should worry you. You are setting yourself up for a major shock when you produce your test plan and your database testing looks nothing like what your boss thinks of as database testing.

For example: He might want you to test the database software itself, in isolation of any application or system. He might mean he wants you to test the system, and include some tests to look in the database and confirm it contains the right content. He may want performance testing, but performance testing the database software is very different from performance testing your application along with the database...

You really should ask your boss a few clarifying questions so you can deliver what is expected.

Mark Irvine
+1 Good advice!
Bill Karwin