Hints for Debugging

Here are some more hints and tips to debug problems in systems. Let's start with some more general rules for debugging:
  • Duplicate the problem
  • Do not think too much
  • Narrow down and focus
Ok let's now get back to the tips and tricks. You got to really know the tools you use. That includes knowing the limitations of the tool set.

Don't guess. Act like a detective and look at clues. Once you think you have a solution, run the system with the same conditions that exhibited the problem and demonstrate that the specific problem was indeed fixed.

Record each step required to make the problem occur. Do not fake the problem. Actually make it happen like it does in real use. You might need to employ automation to speed up the process of creating the bug. That is fine.

I will continue next time with some more general rules for debugging. You know I will come back to tools. And I will examine cause and effect.

Understanding the System

You must understand the system before you can begin debugging it. Here is a novel thought. Read the instructions. This means you should go over the specification for the system. You can also read source code comments. Review the design documentation to gain understand.

Now you must understand one other thing which reading the documentation. You need to take what you read with a grain of salt. Don't trust everything you read.

On the other hand, you really need to know the contents of the user manual. Read it many times until you know it well. You must have a firm grasp on the fundamentals of the system. When I come back, we will get to the second rules of debugging - Make It Fail.

Debugging

Halfway though reading a book on debugging, I realized that I had read it before. It was a good book. So I completed it for a second time. There were a lot of good stories and examples.

The book was written in 2002. However the rules it presented were timeless. The author was actually a hardware/electronics dude. But he nailed the software debugging process down well.

The goal of the advice in the book is to help you find out what is wrong with a system quickly. If you fix your commercial software first, you get a competitive advantage. That translates to more money for your company. So you had better listen up.

When you figure problems out fast, you get to go home quicker too. I know this all too well. If I do not solve problems, I am there to midnight, and I have to return on Saturday morning.

It is difficult to find debuggers who follow the rules in this book. That means if you do learn and use these rules, you will be valuable. Let's first define some terms. Troubleshooting is trying to find out what is broken. Debugging is finding out why. This book is about debugging.

Let's get on with it. The first rule is "understand the system". There are eight more rules. I will be sharing some of these in future posts. Until them, happy hunting.

Acceptance Test Limitations

Our customer has a pretty mature organization. They have their own acceptance test group. They are all employees of the customer organization. Their goal is to test everything we do to ensure the stuff with work in Production.

A while back we delivered a major release. The customer has found all kinds of problems that we missed upon delivery. Luckily we were able to fix most of those issues. However there was a significant piece we were not able to deliver on time. We have been trying to deliver the results piecemeal. However the acceptance team is discovering this effort is producing a lot of bugs. Back to the drawing board.

Recently I read an article about the limits of acceptance tests. They cannot conduct a full regression test. You should not depend too heavily on tools for the tests. The testing only adds value to the effort. It needs management support. And the testers need to learn many skills for the project to benefit. I can honestly say that our customer organization has not let these limits hold back their testing. The acceptance test team really does add significant value to the project. My hat is off to them.

Stolen Art of Unit Testing

I just read a blog post by the author of the book The Art of Unit Testing. He said a PDF version of his book was being shared illegally. The guy even posted a link to one such illegal download. So I downloaded it. I read the first chapter. That's as far as I got. I won't be buying the book.

Even though I took a pass, there were some things to learn from Chapter 1. Your project may fail even if you have unit tests. If fact the unit tests can be a liability. It does not matter whether you employ Test Driven Development. You might still fail. I believe that.

The author does encourage you to use a unit test framework. The examples in his book use NUnit. He also states that unit tests should run quickly. They should be able to finish in a few minutes. He must be talking about some specific unit tests, not the tests for a big system. You should also set up you tests so they do not require manually configuration before running.

I will give the guy one thing. The PDF version of his book was pretty good for a PDF. Most PDFs I view are boring black and white things. He used color appropriately. Since he was getting ripped off by people passing around free copies of his book, I will give out a link to buy The Art of Unit Testing on Amazon. Good luck Roy.

Automated Acceptance Tests

Our customer is a savvy one. They have a full time team that conducts acceptance tests of our software. This team keeps on top of new requirements and the overall business. They make sure they are in the loop at all times during the decision making process. In the end, this team makes the final call on whether our software is ready for prime time.

Here is something new I have read that might help our customer's acceptance test team. That is automated acceptance tests. No that will not put them out of a job. It may make their lives easier. You write up your test cases in some English like language. Most of the time you focus on positive testing. That is, you test the normal case. The benefit it that you can run the tests against every new release.

Currently my customer does acceptance tests manually. That requires them to load up on resources during the software delivery period. It also means that the testers are forever generating huge volumes of interesting test data. That is a good step. However the tedious manual execution of the tests makes me dread the job. I must confess that they are successful in finding where our software breaks down or does not meet the business need. Automated acceptance testing might take their game to the next level. Do I hear a promotion in some acceptance tester's future?

Test Automation

A common theme I read a lot about is the automation of testing. At the root this is wise move. Automate your testing. Then you can code up some changes, and retesting quickly by kicking off the tests. The big three places where automation can be used are unit, regression, and system acceptance tests.

On our own project, most of the test phases are manual. Once in a while I will automate a unit test if I have the time. However we normally have no time in development. Everything is rush rush rush.

Let's step back a minute and define our testing. Unit tests is where small units of code are tested. Normally you write your test cases in the same language that the product is implemented in. You try to cover all the lines of code in your tests. There are popular frameworks which assist in this endeavor.

Regression tests are supposed to cover all the functionality in your product. This is difficult to achieve. There is not really a framework you can pick up to help with this. That is because the products themselves are very diverse. The regression tests themselves can check different characteristics of the system. This includes things like performance.

This one is getting long. So I will pick up with System Acceptance tests next time.