Code Contracts & UnitTests (redux) RRS feed

  • Question

  • From a slightly different perspective of the previous.... Normally, I want the code contract violations to stop me dead in my tracks, and that works by default.

    However when running unit tests as part of an automated build, I would prefer that the test simply fails rather than triggering out an abort.

    I know I can add the handlers to my test classes (as shown in the other thread), but I am looking for something more "global" [right now the project in question has over 10K tests in nearly 1K classes].

    If there was "something" simple...it would be a BIG help....

    Microsoft MVP / ALM Ranger
    Friday, July 1, 2011 9:22 PM

All replies

  • Just uncheck the "Assert on Contract Failure" on project properties.
    Wednesday, July 6, 2011 3:03 PM
  • That would most likely require a different build configuration when running unit tests as part of an automated build (or some type of tool to programmatically change the setting along with a custom TFS build template)
    Microsoft MVP / ALM Ranger
    Wednesday, July 6, 2011 3:20 PM