dimanche 3 avril 2016

Unit testing: should I test my fake objects?

Fake objects (and all test doubles in general) are used to assist in unit tests, but as they contain code, question arises - should they be tested?

On one hand, they are code after all so it should be tested, on the other hand, it is not production code, so testing it seems less important.

I try to write tests for fake objects, as it often doesn't take much time and can save a lot more time debugging, but those tests still look weird to me.

By fake object I mean Gerard Meszaros definition:

A Fake Object is a much simpler and lighter weight implementation of the functionality provided by the DOC without the side effects we choose to do without.

Aucun commentaire:

Enregistrer un commentaire