Skip to main content
NexusGroup Employee Portal

Knowledge base · Software

Testing and debugging a small tool

How to check a utility works and track down a problem methodically.

4 min read · Updated 20 June 20XX · For Anyone building or fixing an internal tool

A tool isn’t finished when it runs — it’s finished when it gives the right answer every time. Here’s a simple way to test and debug.

Testing against expected results

  1. Start with the test cases — each has an input and the expected output.
  2. Run your tool with each input.
  3. Compare the actual output to the expected output, exactly.
  4. A test passes only if they match; otherwise it fails — note which one and why.

Keep going until every case passes, including the tricky ones (like input in a different case).

Debugging a problem

When something’s wrong, work through it calmly:

  1. Reproduce it. Find the exact input that triggers the problem.
  2. Narrow it down. Which step produces the wrong value — input, processing or output?
  3. Check your assumptions. Print or inspect the value at that step; is it what you expected?
  4. Find the cause, not just the symptom. For example, a case-sensitive comparison can make “high” fall through to the wrong branch.
  5. Fix it, then re-test everything — make sure the fix didn’t break another case.

Worked example

Test T5 expects SR-1043 (urgency “high”, lowercase) to come out Critical, but the tool returns Low. Narrowing it down shows the priority check compares urgency exactly, so “high” never matches “High”. Normalising the case before comparing fixes it — and the other tests still pass.

Recording the result

Once all tests pass, note it in your handover: what you tested, that it meets the spec, and anything to watch. See the handover template.