Monday, February 1, 2010

Unit Testing Quiz Part I

Here's a question anyone should be able to answer if they're to be considered proficient at unit testing:

Your client asks you to unit test the serialization/deserialization code for a data model class written by their in-house developers. Since the implementation of the class is sensitive information, you are expected to work without either source code or a description of the serialized form of the model. All you know is the public API of the model: properties and methods, contracts and invariants. The client assures you that the serialized models will only be used by the given code, and do not need to be readable by any other application or implementation. If the class has the methods serialize() and deserialize(), for serializing and deserializing the model respectively, describe how you would write unit tests to test these two functions despite the given constraints.

If I remember I'll post the answer later.

No comments: