Tuesday October 6th

Monday October 5th

0 Kicks

xUnit Theory, the Data Driven Unit Test

A good set of unit tests often end up reusing the same code with varied inputs. Rather than copy and paste that test code over and over, we can use the pattern of data driven unit tests to help streamline our test fixtures. This is the practice of having a single test definition be invoked and count as multiple tests at run time. This also enables us to do other dynamic things, such as configuring our unit tests from external sources. :) I love NUnit, but it does not offer data driven unit tests. I frequently use MSTest, but it's data driven tests inconveniently require you to define a DataSource. Meanwhile xUnit offers several lightweight and simple options for defining data driven tests, which it refers to as theories.


Commenting on Stories is limited for now and will open up to those recommended by the community. Learn how
Loading DotNetKicks...
brought to you by the Kicks Network