When people ask a question about IT the first response will often be a request to provide a simple test case to demonstrate the issue. Typically these requests go unheard by the original poster, because it is seen as too much effort and/or of no relevance to their “real world” problem. Here are some of my thoughts about test cases.
- A simple test case makes it easy for the person answering your question to jump straight in and help. They should not have to spend their time creating scripts to setup a test when you could do it. Don’t waste other people’s time. It gives the impression you think your time is worth more than theirs, which is just rude!
- A test case is not a DESC of a table and the output of a “SELECT * FROM …”. It’s going to take time for someone to turn that into a table and insert statements. That’s your job! Don’t waste other people’s time.
- I know you believe you have asked a really succinct and precise question, but you haven’t. Your question sucks. Your question brings with it a bunch of assumptions I can’t possible know about. Often, the first time I truly understand the question being asked is when I see the test case.
- A test case should be simplified to the point where the issue is still reproducible, but all the extra guff has been removed. It’s better if it doesn’t use your real database objects (tables, views, packages etc.), since you can post it without breaking data protection laws or your company IP policies. Also, it’s likely most of the objects and data in your system are nothing to do with the issue, so don’t include them in your test case.
- Make the test case re-runable. If objects need to be created, include the statements to drop them in the correct order too. This is important for a couple of reasons. It allows you to do a complete re-run for each test, so you don’t introduce some form of cumulative impact. It makes life simpler for the person who is trying to help you. Don’t waste other people’s time.
- A test case acts like a regression test for your understanding of a system. You can rerun them against different database versions and patches and see that what you believe to be true still is.
- Quite often, the process of defining the test case allows you to answer your own question. The removal of the unnecessary stuff allows you to see the real problem. I’m sure you’ve had the experience of trying to explain the problem to someone, only to see the solution for yourself. The test case is that process, without needing the other person. 🙂
- A test case allows you to demonstrate the issue and eventually the resolution, which makes it far easier to get permission to apply the fix in production.
I think you get the picture!
Check out the rest of this series here.