macosunit-testingtestingmonodevelopmspec

How do I debug MSpec tests in MonoDevelop/Xamarin Studio?


Using MonoDevelop 5.x on OSX, I have some failing unit tests using Machine.Specifications that I would like to debug through to find the specific issue that's causing the failure. Is there a way to debug MSpec tests through MonoDevelop?


Solution

  • You can run MSpec code through custom commands allowing you to debug through your tests directly through MonoDevelop:

    1. Go to your project options
    2. Select Run > Custom Commands
    3. Select Execute under the dropdown menu
    4. For the command, browse and select your mspec runner
    5. Select Target File
    6. For the working directory, select Project Directory

    Custom Command Screenshot

    You should now have a command that looks like ../path/to/mspec-clr.exe ${TargetFile}

    You should now be able to place breakpoints in your test code, and start your tests with Start Debugging Item or running in debug mode.