Ignore integration tests when provider is missing

As an integration test I’ve written some unit tests for my MsAccess Data Access Layer. The provider I’m using is OleDb. It will be installed on every desktop machine, but not on our build server.

The build fails because of the missing provider. So, we decided to ignore the tests when the provider was missing. See the boilerplate code below

static List<string> Providers;
static GMCDatabaseFileUser() {
   Providers = new List<string>();
   var reader = System.Data.OleDb.OleDbEnumerator.GetRootEnumerator();
   while (reader.Read()) {
      for (var i = 0; i < reader.FieldCount; i++) {
         if (reader.GetName(i) == "SOURCES_NAME") {
static void EnsureProvider() {
   var provider = "Microsoft.ACE.OLEDB.12.0";
   if (!Providers.Contains(provider)) {
      Assert.Inconclusive("Missing {0}", provider);

Now I can simply call the logic in every unit test and have it ignored when the provider is missing.

public void MyProviderNeedingTest()
   // provider needing test

How will I know this happened on the build server? Check your code coverage, it’ll be less than you expect. Also the ignored tests are in the log.

About erictummers

Working in a DevOps team is the best thing that happened to me. I like challenges and sharing the solutions with others. On my blog I’ll mostly post about my work, but expect an occasional home project, productivity tip and tooling review.
This entry was posted in Uncategorized and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.