How to debug your program when NUnit is running?
2005-04-28 17:13
681 查看
When errors occur in a unit test by making use of NUnit, we may want to debug the program immediately to see where the error occured. But the problem is that it's difficult to enter visual studio's debugger when a unit test is running.
.Net provide us Debugger.Break(System.Diagnostics.Debugger) to solve the problem. You can place a Debugger.Break statement wherever needed. When NUnit executes to the statement, you'll be asked to attach a debugger. If a debugger has already been attached, the statement will be just ignored. Then you can debug your program :)
Sample
[TestFixtureSetUp]
public void Initialize()
[Test]
public void YourCustomizedTest()
Debugger.Break();
}
.Net provide us Debugger.Break(System.Diagnostics.Debugger) to solve the problem. You can place a Debugger.Break statement wherever needed. When NUnit executes to the statement, you'll be asked to attach a debugger. If a debugger has already been attached, the statement will be just ignored. Then you can debug your program :)
Sample
[TestFixtureSetUp]
public void Initialize()
[Test]
public void YourCustomizedTest()
Debugger.Break();
}
相关文章推荐
- How to NSLog a Call stack when a program is running?
- If you have multiple web application run how to determin which is yours when you debug using visual studio 2008?
- [转]How to tell whether your CPU is running in real mode or protected mode
- How to umount when the device is busy
- How to hide/show Toolbar when list is scroling (part 1)
- Deep Learning Enables You to Hide Screen when Your Boss is Approaching
- How to Debug 'The System cannot Execute the specified program' message
- How to debug release mode program in visual studio
- What is SPAWN concurrent program and how to write such program?
- How to release the port of TCP Client immediately when the connection is disconnect with the TCP server. - TCP 客户端与 TCP 服务器断开连接后
- How to debug your application (http protocol) using Fiddler
- Unable to add window -- token android.os.BinderProxy@xxx is not valid; is your activity running
- How to debug HTTP requests when developing and testing Web applications and clients
- 解决【Apache is running a threaded MPM, but your php module is not compiled to be threadsafe.】
- view.WindowManager$BadTokenException: Unable to add window…is not valid; is your activity running?
- How to recover when the SAP spool is full
- unable to add window -- token null is not valid; is your activity running 错误解决办法
- Unable to add window is not valid; is your activity running?
- [JOS]how to debug user mode program in bochs
- [Advance] How to debug a program (下):示例