What It Is

SqlFixture is a .NET library that assists in unit testing applications which rely on SQL Server for data.

Store test data in SQL files

SqlFixture allows you to store your test data as .sql files and execute them directly from your fixture’s set up and tear down methods. This simplifies rebuilding, clearing, and populating your test database. It also ensures that test data is stored outside of your unit test’s code.

Manage initial values and expected results outside of source code

SqlFixture allows you to move your initial values and expected results to a separate XML file, rather than entered as constants or hard-coded values in your unit test. This allows you to maintain these values with a copy of your test data, rather than in your source code.


  • .NET 2.0
  • SQL Server (tested on 2005, but may work on 2000 as well)


No documentation yet. I plan to write a walkthrough for setting up SqlFixture in a new test project soon. However, there is an example library and unit testing project included which works on NUnit.


Download SqlFixture 0.1 source (.zip format)

This version of SqlFixture hasn’t been tested thoroughly. I’ve used it on one project, but your mileage may vary depending on what features you are using. There’s also still a lot to be desired in the way of “Expected Values” testing–I’ve got an idea of where it should be going, the question’s going to be whether I ever need it enough to write it.


Creative Commons License

Creative Commons Attribution-Share Alike 3.0