Nunit在运行测试套件时发生锁定。

3

当我尝试在NUnit中运行测试套件时,出现了问题。在运行测试时锁定,然后显示此错误消息。我使用了最新版本的NUnit,并使用c#,Visual Studio 2010和Selenium客户端驱动程序2.12编写了这些测试。

有任何想法吗?

错误详情:

有关调用即时(JIT)调试而非此对话框的详细信息,请查看此消息结尾。

********** 异常文本 **********

System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:4829



    Server stack trace:



   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)

   at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)

   at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket(EndPoint ipEndPoint)

   at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket()

   at System.Runtime.Remoting.Channels.RemoteConnection.GetSocket()

   at System.Runtime.Remoting.Channels.SocketCache.GetSocket(String machinePortAndSid, Boolean openNew)

   at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.SendRequestWithRetry(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream)

   at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ITransportHeaders& responseHeaders, Stream& responseStream)

   at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)



Exception rethrown at [0]: 

   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

   at NUnit.Core.TestRunner.get_Running()

   at NUnit.Core.ProxyTestRunner.get_Running()

   at NUnit.Util.TestLoader.get_Running()

   at NUnit.Gui.NUnitForm.get_IsTestRunning()

   at NUnit.Gui.NUnitForm.NUnitForm_Closing(Object sender, CancelEventArgs e)

   at System.Windows.Forms.Form.OnClosing(CancelEventArgs e)

   at System.Windows.Forms.Form.WmClose(Message& m)

   at System.Windows.Forms.Form.WndProc(Message& m)

   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

**********加载的程序集 **********

mscorlib

Assembly Version: 2.0.0.0

Win32 Version: 2.0.50727.3625 (GDR.050727-3600)

CodeBase: file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll

nunit

Assembly Version: 2.5.10.11092

Win32 Version: 2.5.10.11092

CodeBase: file:///C:/Program%20Files/NUnit%202.5.10/bin/net-2.0/nunit.exe

nunit-gui-runner

Assembly Version: 2.5.10.11092

Win32 Version: 2.5.10.11092

CodeBase: file:///C:/Program%20Files/NUnit%202.5.10/bin/net-2.0/lib/nunit-gui-runner.DLL

nunit.core

Assembly Version: 2.5.10.11092

Win32 Version: 2.5.10.11092

CodeBase: file:///C:/Program%20Files/NUnit%202.5.10/bin/net-2.0/lib/nunit.core.DLL

nunit.util

Assembly Version: 2.5.10.11092

Win32 Version: 2.5.10.11092

CodeBase: file:///C:/Program%20Files/NUnit%202.5.10/bin/net-2.0/lib/nunit.util.DLL

nunit.uikit

Assembly Version: 2.5.10.11092

Win32 Version: 2.5.10.11092

CodeBase: file:///C:/Program%20Files/NUnit%202.5.10/bin/net-2.0/lib/nunit.uikit.DLL

System.Windows.Forms

Assembly Version: 2.0.0.0

Win32 Version: 2.0.50727.3623 (GDR.050727-3600)

CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

系统

Assembly Version: 2.0.0.0

Win32 Version: 2.0.50727.3624 (GDR.050727-3600)

CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll

System.Drawing

Assembly Version: 2.0.0.0

Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)

CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

nunit.core.interfaces

Assembly Version: 2.5.10.11092

Win32 Version: 2.5.10.11092

CodeBase: file:///C:/Program%20Files/NUnit%202.5.10/bin/net-2.0/lib/nunit.core.interfaces.DLL

System.Configuration

Assembly Version: 2.0.0.0

Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)

CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll

System.Xml

Assembly Version: 2.0.0.0

Win32 Version: 2.0.50727.3082 (QFE.050727-3000)

CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll

System.Runtime.Remoting

Assembly Version: 2.0.0.0

Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)

CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll

nunit.uiexception

Assembly Version: 2.5.10.11092

Win32 Version: 2.5.10.11092

CodeBase: file:///C:/Program%20Files/NUnit%202.5.10/bin/net-2.0/lib/nunit.uiexception.DLL

System.Web

Assembly Version: 2.0.0.0

Win32 Version: 2.0.50727.3618 (GDR.050727-3600)

CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Web/2.0.0.0__b03f5f7f11d50a3a/System.Web.dll

cdqzko4t

Assembly Version: 2.5.10.11092

Win32 Version: 2.0.50727.3624 (GDR.050727-3600)

CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll

********** JIT调试 **********

为了启用JIT调试,必须在该应用程序或计算机(machine.config)的.config文件中将jitDebugging值设置在system.windows.forms部分。

该应用程序还必须编译时启用调试功能。

例如:

<system.windows.forms jitDebugging="true" />

启用JIT调试时,任何未处理的异常

将被发送到计算机上注册的JIT调试器

而不是由此对话框处理。


什么测试?它说套接字连接被主动拒绝了。防火墙,没有监听,没有在那个端口上监听... - Tony Hopkinson
这是一个在运行IE6的应用程序中常见的测试。该测试从数据库中获取数据,并对系统进行一些管理。 - LAB
我所说的是先解决为什么无法连接,否则其他所有的都是无意义的,直到你解决了这个问题。 - Tony Hopkinson
2个回答

2
我也遇到了同样的异常情况,我找到了一些相关的讨论帖子。其中有一个错误可能会导致您的情况出现问题。
在我的情况下,我使用的是NUnit版本2.6.0.1205,该错误已经得到修复。因此,我的情况与错误描述中的情况不同。问题出在我将输出应用程序类型和目标框架从控制台应用程序.NET Framework 4 Client Profile更改为类库.NET Framework 4
解决方法是将它们改回控制台应用程序.NET Framework 4 Client Profile
这并不是完全回答问题的答案,但我希望它能帮助那些遇到相同问题的人。 更新:另一个导致此异常的情况是当一个测试终止进程时。例如,如果测试调用来自另一个DLL的C/C++函数,该函数调用exit,就会发生这种情况。

这个异常的另一个情况是当测试之一终止进程时。对我来说,当一个测试通过调用一些内核函数分配了一个控制台窗口时,就会出现这样的情况。 - chtenb

0

我之前也遇到了同样的问题,但是我通过创建一个新的NUnit项目并重新加载程序集来解决了它。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接