Wednesday, February 17, 2010

Selenium 2.0, Chrome, Hudson, Maven and Windows

I finally got our functional test server to run our functional tests also with the ChromeDriver of Selenium 2.o (WebDriver). Our functional test server is a Windows machine because it is required to run Internet Explorer and our Selenium 2.0 tests with it. This has caused quite a many problems and the last one was that our Hudson continuous integration server did not want to run the Chrome tests.

After a lot of blood, sweat and tears I figured out the problem. The problem was that the Chrome browser seems to install only to the user that run the installation program. The binary just does not start if you run it with another account. The Hudson CI is ran as a Windows service and Windows services are ran with a special system account. You can change the account to another one with the Windows admin tools but then the service cannot interact with the desktop. Like start a browser. Which is quite a showstopper when trying to do browser based testing.

So I would just have to install the Chrome browser using the system account. Easier said than done: one cannot log in as the system account. Some very dark windows magic: I started cmd.exe and then Firefox with system account using the "at" command, downloaded the Chrome installation program with the Firefox instance just started and then installed another instance of Chrome as system user. I also copied the installation from the C:\Documents and Settings\blahblahblah to C:\GoogleSys to have it in a directory without a space in the name - a major menace when passing paths in environment variables like MAVEN_OPTS.

This just so worked and now we have a Hudson running a maven build running Selenium 2.0 functional tests with Internet Explorer, Firefox and Chrome.

No comments:

Post a Comment