0

我想将功能测试纳入我的 Jenkins 工作中。当我使用 nUnit 手动运行测试时,从 Jenkins 运行时一切正常:

"C:\Program Files (x86)\NUnit 2.6\bin\nunit-console.exe" /framework:net-4.0 /xml:functional-tests.xml c:\IISRoot\ALAS-QA\ALAS.Web.Test.dll /apartment=STA /process=Separate

我在每一次测试中都遇到了这个异常

Test Error : ALAS.Web.Test.TestAddLead.TestAddSingleLead
WatiN.Core.Exceptions.BrowserNotFoundException : Could not find an IE window matching constraint: Timeout while waiting to attach to newly created instance of IE.. Search expired after '30' seconds.
at WatiN.Core.IE.CreateIEPartiallyInitializedInNewProcess()
at WatiN.Core.IE.CreateNewIEAndGoToUri(Uri uri, IDialogHandler logonDialogHandler,  oolean createInNewProcess)
at FluentAutomation.WatiN.AutomationProvider.getCurrentBrowser()
at FluentAutomation.WatiN.AutomationProvider.Navigate(Uri pageUri)
at ALAS.Web.Test.TestExtensionMethods.Login(CommandManager I, String username, String password) in c:\java\jenkins\workspace\SCI-ALAS\ALAS.Web.Test\TestExtensionMethods.cs:line 40
at ALAS.Web.Test.TestAddLead.TestAddSingleLead() in c:\java\jenkins\workspace\SCI-ALAS\ALAS.Web.Test\TestAddLead.cs:line 33

我收到此错误的行尝试附加到 IE 窗口。

我在 Windows 2008 服务器上,使用 IE9

添加于 2012 年 8 月 3 日星期五

我读过这可能是

  • 默认情况下,对“localhost”的请求将解析为 ::1 的 IPv6 地址,而不是 127.0.0.1 的 IPv4 地址,WatiN 测试将失败。

情况并非如此,因为我正在针对不在本地计算机上的公共 URL 进行测试。

  • IE 增强安全配置已打开

我已将其关闭,但没有任何结果。

  • 缺少文件 Microsoft.mshtml.dll、Interop.shdocvw.dll 或 Watin.Core.dll

    我在运行测试的输出目录中有那些。

4

1 回答 1

0

我正在通过 Windows 2008 服务器上的 tfs 尝试来自这个 SO 帖子 Watin的信息, 这基本上是说

自动化 UI 测试不能在作为 Windows 服务运行的构建代理中运行,因为它不是交互式的,这意味着它不能与桌面交互

所以我计划通过拥有一个包含 nunit 调用的 bach 文件并在 Jenkins 中运行它来创建我自己的“交互式代理”:

cmd /interactive /c C:\workfolder\nunit-test.bat
于 2012-08-03T14:58:55.610 回答