Maintainable and runs fast

Unit tests should be written in a manner that allows them to run quickly. The test should be easy to implement and any member of a development team should be able to run it. Because software applications are dynamic and continue to evolve, tests for the code base should be easy to maintain as the underlying code under test changes. To have tests that run faster, try to minimize dependencies as much as you can.

Oftentimes, most programmers get this aspect of unit testing wrong, they write unit tests that have inherent dependencies, which in turn makes the tests slower to run. A quick rule of thumb to give you a clue that you are doing something wrong with your unit test, is that they are very slow to run. Also, when ...

Get C# and .NET Core Test Driven Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.