This is my personal blog. The views expressed on these pages are mine alone and not those of my employer.

Tuesday, 25 November 2014

MSTest Breaking Changes and the Legacy Lifesaver

Today I encountered an issue with a group of unit tests that were failing on the build server but running fine on my development machine.

The commonality between these tests is they were all making use of an attribute that extended ExceptionBaseAttribute defined in the UnitTesting namespace.  This extension compared the exception message, rather than just the exception type as provided by the vanilla attributes.

My development machine was running VS 2013 the build server VS 2012. After a bit of digging it was clear I was looking at a breaking change in the VS 2012 test runner.

So what could I do about it?
  • Upgrade the build server? Not viable
  • Ignore the tests? Plain stupid
  • Toggle exception attributes with preprocessor directives? Hacky

There was a fourth option.  MSTest legacy mode.

To enable it I first had to create a solution level file with a .runsettings extension, of which I placed the following contents:

This was then checked in and referenced in the build definition under Automated Tests -> Test Source -> Run Settings:

From this point onwards all tests were running as green as ever.

Perhaps this helped you?  Have you experienced any MSTest breaking changes?


  1. Very Good Site and awesome writing too , and great thanks to the writer


  2. This comment has been removed by a blog administrator.

  3. Long Description Riskonnect is the trusted, preferred source of Integrated Risk Management technology, offering a growing suite of solutions on a world-class cloud computing model that enable clients to elevate their programs for management of all risks across the enterprise. Riskonnect allows organizations to holistically understand, manage and control risks, positively affecting shareholder value Compliance solutions

  4. Since the introduction of outsourcing, many companies have realized that subcontracting IT tasks is far better than paying the fixed costs that an in house IT department brings. remote software developer

  5. I found out your research very interesting and helpful, keep it going cause u make a great things! I love make great things too, and wanna suggest u to try this amazing service with Software for Windows where I always download onle the latest versions of all apps.