简体   繁体   English

如何调试特定的行测试?

[英]How Can I Debug a Specific Rowtest?

How can I debug a specific rowtest? 如何调试特定的行测试?

I'm using Visual Studio and nUnit. 我正在使用Visual Studio和nUnit。 TDD.NET addon is great but it doesn't let me to debug a specific rowtest, before coming to my test I have to go through all previous tests. TDD.NET插件很棒,但是它不允许我调试特定的行测试,因此在进行测试之前,我必须完成所有以前的测试。

I know there are some commercial solutions for this. 我知道有一些商业解决方案。 I'm looking for a free (or really cheap) solution. 我正在寻找免费(或非常便宜)的解决方案。

    <RowTest()> _
    <Row("x")> _
    <Row("y")> _
    <Row("z")> _
    Public Sub TEst(ByVal fileToParse As String)
...
End Sub 

In this case to able to test Row("z") I have to go through "x" and "y" and I've got some tests with 10+ rows. 在这种情况下,要测试Row(“ z”),我必须经过“ x”和“ y”,并且我已经对10多个行进行了一些测试。

2 not good enough solutions : 2个不够好的解决方案:

  • Using conditional breakpoints as a work around. 使用条件断点来解决。
  • Launching debug mode with nUnit and running that rowtest from the nUnit GUI. 使用nUnit启动调试模式,并从nUnit GUI运行该行测试。 But this takes quite a bit time, and sometimes I don't want to make my unit test DLL as startup project. 但这需要花费很多时间,有时我不想将单元测试DLL作为启动项目。

Well a dirty solution would be to comment-out all the other rows, and then debug :). 不错的解决方案是注释掉所有其他行,然后调试:)。

Or put an if statement in code which checks for the fileToParse parameter's value (let's say "y") and put a breakpoint inside (C# code): 或在代码中放入if语句,以检查fileToParse参数的值(假设为“ y”)并在其中放入断点(C#代码):

 if (fileToParse == "y")
 {
    int a = 0; a++;
 }

我最终在Debug中启动nUnit,然后双击该行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM