I'm writing a massive test harness at the moment.

Advice from a former colleague of mine : "If you are unsure of how to proceed, write a test. You will be surer of how to proceed afterwards."

Its another good tool to have in your toolbox. Sometimes the right answer is prototyping, or writing a document or drawing a diagram. But I do find writing a test often exposes quite a lot of unknowns or hard things that you actually do need to know about.

It can be very hard due to how things are structured, and also require a lot more effort than actually writing the original code.

But if you are unsure about something, it can be a reasonable shortcut to gain the necessary knowledge about the things surrounding your code, in terms of what they are doing and how they are implemented.

Even just thinking "I can't write a test for that", and understanding why is insightful. It generally highlights either a flawed design, a tool you are missing (and could acquire or build), or a gap in your knowledge that needs to be filled.

Its undoubtedly one of those "inventing on principle" type things.

Inventing on Principle

With the principle being "This must be testable". All manner of things can be invented or learned by following the principle.