使用 IE.GetCookie 的 WatiN 测试仅在 CruiseControl 中失败

发布于 2024-07-06 14:22:28 字数 521 浏览 8 评论 0原文

我今天在我们的应用程序中添加了一些简单的 WatiN 测试,以检查 cookie 值是否正确存储。

测试在团队中的所有机器上本地通过。 然而,当 CruiseControl 在我们的构建服务器上运行测试时,这些新测试在包含

browser.GetCookie(url, cookieName)

的行上失败。 CruiseControl 日志中给出的错误是老栗子:

对象引用未设置为对象的实例。

我已使用远程桌面登录到构建服务器,使用 CruiseControl 运行时使用的相同用户帐户,并手动运行 MbUnit,并且测试通过。 因此,构建服务器上访问 cookie 的权限不会有问题。

我已经查看了所有 WatiN 文档以寻求帮助,但一无所获。 我已重新启动 CruiseControl 服务。 我已经尝试了我能想到的一切,但现在我完全不知道巡航控制运行这些测试的方式可能会有所不同。

有谁知道可能导致此问题的原因和/或如何解决它?

I added some simple WatiN tests to our app today to check that a cookie value is stored correctly.

The tests pass locally on all machines in the team. However, when CruiseControl runs the tests on our Build server these new tests fail on the line containing

browser.GetCookie(url, cookieName)

The error given in the CruiseControl log is the old chestnut of:

Object reference not set to an instance of an object.

I have logged on to the Build server with Remote Desktop, using the same user account that CruiseControl runs under, and run MbUnit manually, and the tests pass. So it can't be a problem with the permissions on the Build server to access cookies.

I have looked through all the WatiN documentation for help, but come up empty. I've restarted the CruiseControl service. I've tried everything I can think of and I'm now completely at a loss now as to what could be different in the way Cruise Control runs these tests.

Does anybody know what could be causing this and/or how to resolve it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

放血 2024-07-13 14:22:28

尝试将 CruiseControl 作为应用程序而不是服务运行。 从服务运行时,WatiN 往往会挂起(因为 Windows 服务未附加到 UI 会话,并且 WatiN 需要一个来处理 IE 中的对话框)。

但除此之外……请记住,IE cookie 存储在您的用户配置文件中。 服务运行时不会加载配置文件——它们是在后台安静运行的守护进程,实际上并不在登录会话的上下文中运行。 我怀疑这就是你异常的原因。

Try running CruiseControl as a application instead of as a service. WatiN tends to hang when run from a service (since windows services are not attached to a UI session, and WatiN requires one for handling dialog boxes in IE).

But besides that ... recall that IE cookies are stored in your user profile. Profiles are not loaded when services run -- they are daemon processes that run quietly in the background and don't actually run in the context of a logon session. I suspect that's the cause of your exception.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文