This project is read-only.

HOW TO: Debug an issue in the unit tests

  • Add a Debugger.Break(); into StyleCopTestHarness.Program.cs in the Main() entry point and rebuild solution.
  • Set a BreakPoint in the code where you'd like to stop
  • Run checked tests as usual (do not debug the test)
  • Pick your running instance of VS to debug it with
  • F5 from the Debugger.Break entry to hit your other breakpoint in code

Debugging a test failure in the IDE

  • Run a checked test.
  • IF it fails rightclick the test result and go to 'View Test Results Details'
  • At the bottom in 'Collected Files' you will have links to the violation files.
  • The first file will just be a file containng the fact that the test failed.
  • The second file will be details of Extra Violations or Missing Violations or both.
  • Set a breakpoint in the analyzer or parser.
  • Right click the test and debug it.
  • Often, if you're changing the analyzer source, you'll need to rebuild the solution and Refresh in Test List Editor

Last edited Mar 21, 2012 at 11:12 AM by andyr, version 3