Imagine this: you’ve just been assigned maintenance of a system. You’re eager to understand what the system does so the first thing you do is to look for tests. You’re in luck, there are hundreds of them. After having opened up a few of them, you start seeing objects being constructed left and right, filled with values like 123, “Test” and “Foo”. What do all those values mean? Are they relevant for the outcome of the tests? What is really going on here?
In this session I’ll show you how to get rid of those questions by leveraging anonymous test data. By using a library such as AutoFixture to runtime-generate test data that meets your requirements, you can free yourself from having to write a lot of boilerplate setup code in your tests, leaving them to contain just the essence of what is being tested. It’ll also make them more robust, since they no longer rely on hard coded constants to determine their outcome.
Like with my other things in life, less is more. Learn how to apply this powerful principle to your tests.