How to run White + SL4 UATs through TeamCity?
- by Duncan Bayne
After experiencing a series of unpleasant issues with TFS, including source code orruption and project management inflexibility, we (meaning the project team of which I'm a part) have decided to move from TFS 2010 to TeamCity + SVN + V1.
I've managed to get our MSTest component and unit tests running as part of every build. However, our UATs are failing, and I was hoping for some advice from the TeamCity community as to best practices w.r.t. running web servers and interacting with the desktop.
Each of our UAT fixtures starts a web server to host the site, like this:
public static void StartWebServer()
{
var pathToSite = @"C:\projects\myproject\FrontEnd\MyProject.FrontEnd.Web";
var webServer = new Process
{
StartInfo = new ProcessStartInfo
{
Arguments = string.Format("/port:9150 /path:\"{0}\"", pathToSite),
FileName = @"C:\Program Files (x86)\Common Files\microsoft shared\DevServer\10.0\WebDev.WebServer40.EXE"
}
};
webServer.Start();
}
Needless to say, this doesn't work when running through TeamCity, as the pathToSite value is different each time. I'm hoping there is a way of determining the path into which the the code is checked out prior to building? That would allow me to point the web server at the right place.
The other issue is that our UATs use White to drive the Silverlight UI through an instance of Internet Explorer:
_browserWindow = InternetExplorer.Launch("http://localhost:9150/index.html#/Home", "Home - Windows Internet Explorer");
_document = _browserWindow.SilverlightDocument;
I've ensured that the TeamCity service is granted the ability to interact with the desktop, and I've set the build agent machine up to log in automatically (an open session is a pre-requisite for White to work properly). Is that all I need to do or are there additional steps required?