开发者

Watin Test works from Visual Studio but not CCNet running as Windows Service

开发者 https://www.devze.com 2023-01-25 00:52 出处:网络
We have a Watin test for a page with a ajax model popup window. The test is trying to open the window, hide it then reshow it.

We have a Watin test for a page with a ajax model popup window. The test is trying to open the window, hide it then reshow it.

The test runs fine when I run it from Visual Studio or our local build scripts. The test fails when it runs on the build server.

The build server is Cruise Control.Net running as a Windows Service (logged in as a domain account). Our build scripts are written in NAnt and we are running th开发者_StackOverflowe Watin tests using the method described in this post.

The modal ajax popup window is implemented using jquery.

We are using:

  • Watin 2.0.20
  • NUnit 2.5.5
  • Windows Server 2003 with IE7
  • jQuery 1.4.2

Here is a snippet of the failing test.



            _ieBrowser.Button("btnToggle").Click();
            _ieBrowser.WaitForComplete();

            Assert.IsTrue(_ieBrowser.Button("btnReshow").Exists);

            _ieBrowser.Button("btnReshow").Click();
            _ieBrowser.WaitForComplete();

            _ieBrowser.TextField("editBody").WaitUntilExists();
            Assert.IsTrue(_ieBrowser.TextField("editBody").Text.Contains(thisIsCustomer));

            _ieBrowser.Button("btnDone").Click();
            _ieBrowser.WaitForComplete();

This line:

_ieBrowser.TextField("editBody").WaitUntilExists();

times out.


By default a Windows Service cannot interact the desktop.

If you go into the properties of the service, then look at the Log On tab, you will see 2 options for the account of your service: Local System Account or other specified account.

If you select Local System account, it will enable the Allow service to interact with the desktop check box.

If you enable that option, then restart your service, it should allow the service to open and close windows.


Problem is that Windows Service cannot have windows. That is why your test fails.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号