As I'm using NUnit more and more (i really started to fall in love with the whole unit-test concept), i find it sometimes useful to be able to debug while running the unit-test. Turns out to be quite easy. This is how it's done:
1) Put your unit-tests into separate project (I do that anyway to keep the NUnit out of "live" references) and compile it (make it either exe or dll, no difference).
2) Start NUnit, browse the compiled dll/exe (from step 1), select "File -> Save as" and save the nunit project. I typically save it in the project's root as "myproject.nunit".
3) Open the project's properties, "Debug" tab.
4) Set "Start Action" to "Start external program:" and browse the "nunit.exe" (e.g. c:\program files\nunit 2.4.1\bin\nunit.exe)
5) Set in the "Start Options" the "Command line arguments" to point to the nunit project you created in step 2. If you did the same as me, i.e. saved it in the project's root, the path should be something like "..\..\myproject.nunit"
And that's it! Just run the debug with F5 as usuall and it'll open NUNIT environment. Set break-points wherever you need in the code and run the appropriate test...
Subscribe to:
Post Comments (Atom)
1 comment:
You write very well.
Post a Comment