0

我在作为解决方案一部分的测试项目中有几个 NUnit 测试。我在每种测试方法中都有一个断点。这些方法中的“典型”之一是:

public void TestHHSInterface()
{
    var HHSClient = IOC.container.Resolve<IHHSClient>();

    var s = HHSClient.GetTestMessage("Duckbilled", "Platypus");

    Assert.Greater(s.Value.Length, 0);
}

测试运行,正如我在这里看到的那样:

在此处输入图像描述

没有命中断点是正常的吗?似乎它们正在运行,但结果(通过 3,失败 0)并不是真正有效的,因为我添加了应该失败的测试代码,但无论如何,测试“成功”。

我在做什么错,或者在这里省略?

更新

好的,我下载/安装了 NUnit 测试适配器,右键单击上面显示的测试,然后选择“调试测试”

我的断点被击中,我能够跨过第一行,但随后它爆炸了;这是我在“输出”窗格中看到的(我知道这可能是“TMI”,但我不知道什么是相关的,什么不是 - 我剪掉了中间,因为我的帖子太长了):

“vstest.executionengine.x86.exe”(CLR v4.0.30319:DefaultDomain):已加载“C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll”。无法找到或打开 PDB 文件。“vstest.executionengine.x86.exe”(CLR v4.0.30319:DefaultDomain):加载了“C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\vstest.executionengine.x86。可执行程序'。无法找到或打开 PDB 文件。'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): 加载'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\ Microsoft.VisualStudio.TestPlatform.TestExecutor.Core.dll'。无法找到或打开 PDB 文件。'vstest.executionengine.x86.exe' (CLR v4.0. 30319: vstest.executionengine.x86.exe): 加载'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'。无法找到或打开 PDB 文件。'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): 加载'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\ Microsoft.VisualStudio.TestPlatform.ObjectModel.dll'。无法找到或打开 PDB 文件。'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): 加载'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\ Microsoft.VisualStudio.TestPlatform.Core.dll'。无法找到或打开 PDB 文件。'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest. executionengine.x86.exe): 加载'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel\v4.0_4.0.0.0__b77a5c561934e089\System.ServiceModel.dll'。无法找到或打开 PDB 文件。'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): 加载'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089 \System.Core.dll'。无法找到或打开 PDB 文件。'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): 加载'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a \System.Configuration.dll'。无法找到或打开 PDB 文件。'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): 加载'C:\Windows\Microsoft. 网络\程序集\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'。无法找到或打开 PDB 文件。“vstest.executionengine.x86.exe”(CLR v4.0.30319:vstest.executionengine.x86.exe):已加载。. . .

'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): 加载'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\ msdia120typelib_clr0200.dll'。无法找到或打开 PDB 文件。'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): 加载'C:\Users\clay\AppData\Local\Temp\nunit20\ShadowCopyCache\10796_635403224540977618\Tests_5885246 \assembly\dl3\62b76a75\bbee3246_019acf01\CStore.Integration.Tests.dll'。已加载符号。'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): 加载'C:\Users\clay\AppData\Local\Temp\nunit20\ShadowCopyCache\10796_635403224540977618\Tests_5885246 \assembly\dl3\8379df6f\6a4e7a10_1f92cf01\Castle.Windsor.dll'。无法找到或打开 PDB 文件。'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): 加载'C:\Users\clay\AppData\Local\Temp\nunit20\ShadowCopyCache\10796_635403224540977618\Tests_5885246 \assembly\dl3\4c09b93f\71022b68_fc99cf01\HHS.Client.dll'。已加载符号。'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): 加载'C:\Users\clay\AppData\Local\Temp\nunit20\ShadowCopyCache\10796_635403224540977618\Tests_5885246 \assembly\dl3\d29638a9\7a8b1a66_fc99cf01\CStore.DomainModels.dll'。已加载符号。'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): 加载'C:\Users\clay\AppData\Local\Temp\nunit20\ShadowCopyCache\10796_635403224540977618\Tests_5885246 \组装\dl3\3926c47b\2e2ff20f_1f92cf01\城堡。设施.FactorySupport.dll'。无法找到或打开 PDB 文件。'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): 加载'C:\Users\clay\AppData\Local\Temp\nunit20\ShadowCopyCache\10796_635403224540977618\Tests_5885246 \assembly\dl3\e881bc9e\8fb83744_0896cf01\CStore.Common.dll'。已加载符号。'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): 加载'C:\Users\clay\AppData\Local\Temp\nunit20\ShadowCopyCache\10796_635403224540977618\Tests_5885246 \assembly\dl3\21c8b534\60cca60f_1f92cf01\Castle.Core.dll'。无法找到或打开 PDB 文件。'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): 加载'C: \Users\clay\AppData\Local\Temp\nunit20\ShadowCopyCache\10796_635403224540977618\Tests_5885246\assembly\dl3\28a3025a\10087044_0896cf01\MapStores.dll'。已加载符号。'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): 加载'C:\Users\clay\AppData\Local\Temp\nunit20\ShadowCopyCache\10796_635403224540977618\Tests_5885246 \assembly\dl3\a137cbd9\253adc44_0896cf01\HBaseMapStore.dll'。已加载符号。'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): 加载'C:\Users\clay\AppData\Local\Temp\nunit20\ShadowCopyCache\10796_635403224540977618\Tests_5885246 \assembly\dl3\07c00fd2\f8f7a644_0896cf01\MQProcessing.MQPutService.dll'。已加载符号。'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): 加载'C: \Users\clay\AppData\Local\Temp\nunit20\ShadowCopyCache\10796_635403224540977618\Tests_5885246\assembly\dl3\bae09939\c8a9ee66_fc99cf01\CStore.Data.dll'。已加载符号。'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): 加载'C:\Users\clay\AppData\Local\Temp\nunit20\ShadowCopyCache\10796_635403224540977618\Tests_5885246 \assembly\dl3\a22b9b5d\688b1868_fc99cf01\CSPoll.Client.dll'。已加载符号。'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): 加载'C:\Users\clay\AppData\Local\Temp\nunit20\ShadowCopyCache\10796_635403224540977618\Tests_5885246 \assembly\dl3\30e797f5\2901ac44_0896cf01\CStore.Common.HTTP.dll'。已加载符号。'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): 加载'C: \Windows\Microsoft.Net\assembly\GAC_MSIL\System.Net.Http\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Net.Http.dll'。无法找到或打开 PDB 文件。'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): 加载'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4 .0.0.0__b77a5c561934e089\System.Core.dll'。无法找到或打开 PDB 文件。'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): 加载'C:\Users\clay\AppData\Local\Temp\nunit20\ShadowCopyCache\10796_635403224540977618\Tests_5885246 \assembly\dl3\4590d591\2f177866_fc99cf01\DeviceConfig.Client.dll'。已加载符号。'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): 加载'C: \Users\clay\AppData\Local\Temp\nunit20\ShadowCopyCache\10796_635403224540977618\Tests_5885246\assembly\dl3\247d65ee\763b5c67_fc99cf01\CStore.Client.dll'。已加载符号。'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): 加载'C:\Users\clay\AppData\Local\Temp\nunit20\ShadowCopyCache\10796_635403224540977618\Tests_5885246 \assembly\dl3\f5f7b992\7e1ebf67_fc99cf01\CStore.BusinessObjects.dll'。已加载符号。'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): 加载'C:\Users\clay\AppData\Local\Temp\nunit20\ShadowCopyCache\10796_635403224540977618\Tests_5885246 \assembly\dl3\c8d39645\9db0b068_fc99cf01\MQProcessingWCFServices.dll'。已加载符号。“vstest.executionengine.x86.exe”(CLR v4.0.30319:测试域-HHS.Web.Tests.dll):已加载“C:\Users\clay\AppData\Local\Temp\nunit20\ShadowCopyCache\10796_635403224540977618\Tests_5885246\assembly\dl3\6a87a030\23c15269_fc99cf01\HHS.API.dll”。已加载符号。'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): 加载'C:\Users\clay\AppData\Local\Temp\nunit20\ShadowCopyCache\10796_635403224540977618\Tests_5885246 \assembly\dl3\ba0add0f\0aa77e66_fc99cf01\CStore.Data.Legacy.dll'。已加载符号。'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): 加载'C:\Users\clay\AppData\Local\Temp\nunit20\ShadowCopyCache\10796_635403224540977618\Tests_5885246 \assembly\dl3\82c78164\30882368_fc99cf01\CStore.BusinessObjects.HHS.dll'。已加载符号。'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests. dll): 已加载“匿名托管的 DynamicMethods 程序集”。“vstest.executionengine.x86.exe”(CLR v4.0.30319:test-domain-HHS.Web.Tests.dll):加载了“CastleDictionaryAdapterAssembly”。线程 0x27f4 已退出,代码为 259 (0x103)。线程 0xaa4 已退出,代码为 259 (0x103)。线程 0x1c70 已退出,代码为 259 (0x103)。线程 0x2578 已退出,代码为 259 (0x103)。'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): 加载'C:\Users\clay\AppData\Local\Temp\nunit20\ShadowCopyCache\10796_635403224540977618\Tests_5885246 \assembly\dl3\ac0d956f\b951e91a_1f92cf01\Newtonsoft.Json.dll'。无法找到或打开 PDB 文件。'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): 加载'C:\Windows\Microsoft. Net\assembly\GAC_MSIL\System.Net.Http.WebRequest\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Net.Http.WebRequest.dll'。无法找到或打开 PDB 文件。System.dll 中发生“System.Net.Sockets.SocketException”类型的第一次机会异常 System.dll 中发生“System.Net.Sockets.SocketException”类型的第一次机会异常 System.Net 类型的第一次机会异常.WebException'发生在 System.dll 类型“System.AggregateException”的第一次机会异常发生在 mscorlib.dll 类型“System.ObjectDisposedException”的第一次机会异常发生在 System.dll 类型“System.Exception”的第一次机会异常'发生在 HHS.Client.dll 在 mscorlib 中发生了“System.Reflection.TargetInvocationException”类型的第一次机会异常。dll 在 nunit.core.dll 中发生“NUnit.Core.NUnitException”类型的第一次机会异常线程 0x2128 已退出,代码为 259 (0x103)。线程 0x28a0 已退出,代码为 259 (0x103)。线程 0x29d8 已退出,代码为 259 (0x103)。'vstest.executionengine.x86.exe'(CLR v4.0.30319:域 2):已卸载 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll''vstest .executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): 卸载'C:\Users\clay\AppData\Local\Temp\VisualStudioTestExplorerExtensions\NUnitTestAdapter.1.0\lib\nunit .core.dll' 'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): 卸载'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\ v4.0_4.0.0。线程 0x24a0 已退出,代码为 259 (0x103)。Microsoft.VisualStudio.TestPlatform.TestExecutor.Core.dll 中发生“System.InvalidOperationException”类型的第一次机会异常 System.ServiceModel.dll 中发生“System.ServiceModel.CommunicationObjectAbortedException”类型的第一次机会异常类型的第一次机会异常System.ServiceModel.dll 中发生“System.ServiceModel.CommunicationObjectAbortedException” System.ServiceModel.Internals.dll 中发生“System.ServiceModel.CommunicationObjectAbortedException”类型的第一次机会异常 发生“System.IO.IOException”类型的第一次机会异常在 System.dll 中 System.ServiceModel 中发生了“System.ServiceModel.CommunicationObjectAbortedException”类型的第一次机会异常。dll System.ServiceModel.dll 中发生“System.ServiceModel.CommunicationObjectAbortedException”类型的第一次机会异常 System.ServiceModel.Internals.dll 中发生“System.ServiceModel.CommunicationObjectAbortedException”类型的第一次机会异常“类型”的第一次机会异常System.ServiceModel.CommunicationObjectAbortedException'发生在 System.ServiceModel.Internals.dll 类型“System.InvalidOperationException”的第一次机会异常发生在 Microsoft.VisualStudio.TestPlatform.TestExecutor.Core.dll 程序“[10796] vstest.executionengine.x86 .exe:“程序跟踪”已以代码 0 (0x0) 退出。程序“[10796] vstest.executionengine.x86.exe”已退出,代码为 0 (0x0)。System.ServiceModel.dll 中发生 CommunicationObjectAbortedException' System.ServiceModel.Internals.dll 中发生“System.ServiceModel.CommunicationObjectAbortedException”类型的第一次机会异常 System.ServiceModel 中发生“System.ServiceModel.CommunicationObjectAbortedException”类型的第一次机会异常。 Internals.dll Microsoft.VisualStudio.TestPlatform.TestExecutor.Core.dll 中出现“System.InvalidOperationException”类型的第一次机会异常程序“[10796] vstest.executionengine.x86.exe:程序跟踪”已退出,代码为 0( 0x0)。程序“[10796] vstest.executionengine.x86.exe”已退出,代码为 0 (0x0)。System.ServiceModel.dll 中发生 CommunicationObjectAbortedException' System.ServiceModel.Internals.dll 中发生“System.ServiceModel.CommunicationObjectAbortedException”类型的第一次机会异常 System.ServiceModel 中发生“System.ServiceModel.CommunicationObjectAbortedException”类型的第一次机会异常。 Internals.dll Microsoft.VisualStudio.TestPlatform.TestExecutor.Core.dll 中出现“System.InvalidOperationException”类型的第一次机会异常程序“[10796] vstest.executionengine.x86.exe:程序跟踪”已退出,代码为 0( 0x0)。程序“[10796] vstest.executionengine.x86.exe”已退出,代码为 0 (0x0)。System.ServiceModel.Internals.dll 中发生 ServiceModel.CommunicationObjectAbortedException' System.ServiceModel.Internals.dll 中发生“System.ServiceModel.CommunicationObjectAbortedException”类型的第一次机会异常 Microsoft 中发生了“System.InvalidOperationException”类型的第一次机会异常。 VisualStudio.TestPlatform.TestExecutor.Core.dll 程序“[10796] vstest.executionengine.x86.exe:程序跟踪”已退出,代码为 0 (0x0)。程序“[10796] vstest.executionengine.x86.exe”已退出,代码为 0 (0x0)。System.ServiceModel.Internals.dll 中发生 ServiceModel.CommunicationObjectAbortedException' System.ServiceModel.Internals.dll 中发生“System.ServiceModel.CommunicationObjectAbortedException”类型的第一次机会异常 Microsoft 中发生了“System.InvalidOperationException”类型的第一次机会异常。 VisualStudio.TestPlatform.TestExecutor.Core.dll 程序“[10796] vstest.executionengine.x86.exe:程序跟踪”已退出,代码为 0 (0x0)。程序“[10796] vstest.executionengine.x86.exe”已退出,代码为 0 (0x0)。dll Microsoft.VisualStudio.TestPlatform.TestExecutor.Core.dll 中出现“System.InvalidOperationException”类型的第一次机会异常程序“[10796] vstest.executionengine.x86.exe:程序跟踪”已退出,代码为 0 (0x0) . 程序“[10796] vstest.executionengine.x86.exe”已退出,代码为 0 (0x0)。dll Microsoft.VisualStudio.TestPlatform.TestExecutor.Core.dll 中出现“System.InvalidOperationException”类型的第一次机会异常程序“[10796] vstest.executionengine.x86.exe:程序跟踪”已退出,代码为 0 (0x0) . 程序“[10796] vstest.executionengine.x86.exe”已退出,代码为 0 (0x0)。

4

1 回答 1

2

如果没有命中断点,则不附加调试器(或不执行代码)。我建议你为 Visual Studio 使用NUnit 测试适配器。它将允许您在适当的位置调试测试 - 只需选择测试并在上下文菜单中选择调试选定的测试。

另一种选择 - 您可以将调试器附加到 NUnit GUI 进程并Debugger.Break()在测试代码中使用。

于 2014-07-07T16:06:39.837 回答