views:

236

answers:

1

Hello,

I'm trying to run WatiN tests through continuous build on TFS, but I can't get it to work. The errror I get is following:

WatiN.Core.Exceptions.IENotFoundException : 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, Boolean createInNewProcess)
     at WatiN.Core.IE..ctor(String url, Boolean createInNewProcess)

I've read that this may be the cause of

  • Requests for "localhost" will resolve to the IPv6 address of ::1 by default rather than the IPv4 address of 127.0.0.1 and the WatiN tests will fail.

This is not the case, because I'm testing against a public URL not on the local machine.

  • IE Enhanced Security Configuration turned on

I've turned this off without any result.

  • Missing files Microsoft.mshtml.dll, Interop.shdocvw.dll or Watin.Core.dll

Check and double check! I have those in my output directory where the tests are run.

The last and final test was to login as the user that runs the build and executes the NUnit testing suite and run the tests by hand.

C:\Users\TFSSERVICE>"C:\Program Files\Nunit 2.5.2\bin\net-2.0\nunit-console.exe"
 /nologo C:\Users\BUILDSERVICE\AppData\Local\Temp\\Continuous\Binaries\Release
\\WebTests.dll

Guess what! It works executing them manually as the tfs build user. So, what am I missing here? Have any ideas why it just keeps timing out when I run through the msbuild engine?

Any thought are welcome! Mikael

+2  A: 

Judging by the error, it is looking for an Intenet Explorer window. Which it won't be able to find if the build process is being run by a service.

EDIT: Previously I said I didn't know how to fix this.
Although I don't, this page does. Look for the section titled "Automated UI Tests". This ought to work for WatiN as well.

pipTheGeek
You are my hero of the day! Thank you! This was exactly my problem, and the solution were easier than I thought. Kudos to you!
Mikael Lundin
If it is any help, I was posting a suggestion about allowing the build service to interact with the desktop, I was looking to find the name of the service when I found the article that I linked to. Total luck on my part. I had also previously looked for a way to run UI unit test from the TFS build service, so I'm glad I found it.
pipTheGeek