After several months of neglect, we are currently working on getting the Nancy project ship shape on Mono. We’ve gotten to the point now where everything builds and runs just fine, but we have a few tests that fail when running on Linux/Mono. The failures we are seeing are obviously bugs in the tests/stubs/mocks themselves, and we need to debug them to see exactly what’s going on. MonoDevelop has some decent test runner features, but they appear to be heavily tied to NUnit which is a problem if you happen to use xUnit 🙂
Debugging With xUnit
Luckily the solution is relatively simple, if a little clunky:
- Download the latest xUnit release and unzip it somewhere.
- Set whatever breakpoint you need in MonoDevelop and build the test project (in debug mode, obviously).
- In MonoDevelop, go to Run, Debug Application, browse to where you extracted the ZIP from step 1 and choose the appropriate xunit.gui.*.exe depending on your target framework/architecture (xunit.gui.clr4.exe in our case).
- The gui xUnit runner will popup – click Assembly, Open, browse to the output of your test project, select the assembly and press OK.
- Click Run All in the bottom left.
The runner will run the tests and you should break out into MonoDevelop whenever you hit a breakpoint.
Pretty simple, if a bit of a ballache – but hey, you shouldn’t need to debug your tests very often anyway 🙂