开发者

Tests with pseudo-correct data

Recently I have found some classes in our system which are not covered by tests. There is one common thing for all these classes: it is very difficult to get correct test dat开发者_开发知识库a for them (these classes emulate internal memory representation of some medical devices).

Without tests we just hope these classes work correctly. But after discussion with colleagues we came to the following solution. We decided to assume current implementation works correctly and create tests based on it (put to current implementation some input and get output - it is out test data). So the test will fail if we break something. But if this test fails there is a probability test data was incorrect and we need to fix it. We call this kind of tests pseudo-correct (suggest a better name) and put the follwing comment at the start of the test: "Dear colleague, this test is based on pseudo-correct data. See here (internal wikipedia link) for more details".

I want to know what you think about this kind of tests. And may be there is already a wide-spread name for them?


It's definitely better than having no tests :)

What you are doing is essentially creating a snapshot of the system in its current state. If you trust that state, the unit test suite represents a known good state. This is the same idea that drives Pex.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜