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

How to debug your program when NUnit is running?[TestFixtureSetUp]
How to debug your program when NUnit is running?
public void Initialize()
{
How to debug your program when NUnit is running?  How to debug your program when NUnit is running?.
How to debug your program when NUnit is running?  Debugger.Break();
How to debug your program when NUnit is running?  How to debug your program when NUnit is running?.
How to debug your program when NUnit is running?}

How to debug your program when NUnit is running?
How to debug your program when NUnit is running?[Test]
How to debug your program when NUnit is running?
public void YourCustomizedTest()
{
How to debug your program when NUnit is running?  How to debug your program when NUnit is running?.
How to debug your program when NUnit is running?  Debugger.Break();
How to debug your program when NUnit is running?  How to debug your program when NUnit is running?.
How to debug your program when NUnit is running?}

How to debug your program when NUnit is running?

How to debug your program when NUnit is running?

相关文章:

  • 2021-08-26
  • 2022-12-23
  • 2021-07-21
  • 2022-12-23
  • 2021-10-07
  • 2021-11-01
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-06
  • 2021-07-21
  • 2022-12-23
  • 2022-01-28
相关资源
相似解决方案