From: Trans Date: 2009-06-15T23:45:11+09:00 Subject: Runtime Checks Testing While expanding on unit tests for a project, I started to wonder if a "pre-unit testing" system made any sense --basically a dynamic runtime checks system. The idea is that for every class, you create a runtime check subclass, in which methods provide real-time conditions. Then there would be some mode switch that would automatically use the check classes vs the regular ones. Eg. class MyClass def exclaim(y) y + "!" end end class MyClass::Check < MyClass def exclaim(y) result = super raise SystemCheckError unless result == "#{y}!" result end end Now obviously this is a very stupid example, but it presents the basic idea. This is sort of like double entry book keeping. We are creating some real-time checks to ensure things are running along as we expect them too. What do others think of this sort of thing? How might a system like this effect unit testing? Could it replace it? Or help reduce the extent that unit tests are needed? Or simply compliment them? Or is this a worthless notion all together? One thing I notice, it has some upside in encouraging good coding by encouraging small methods. T.