Trackyon CUIT Helpers

Trackyon LLC CUIT Helpers

The Coded UI Test (CUIT) Helpers from Trackyon LLC allows IIS Express or Visual Studio Development Server (Cassini Web server) to be started by your test.  This prevents Coded UI Test from beginning without a server running.

Features:

  • Start and Stop IIS Express
  • Start and Stop Visual Studio Development Server (Cassini Web server)

Usage:

To start using the package verify the app.config file of your test project contains either the webDevPath and/or the iisExpressPath values added to your appSettings section. These values are used by the library to start the respective web server.  If you installed the package using nuget the keys were added for you with paths assuming you are running .NET 4.0 and on a 64 bit machine.  If you are not running .NET 40 or not on a 64 bit machine you will need to adjust the paths.

<add key="webDevPath" value="C:\Program Files (x86)\Common Files\microsoft shared\DevServer\11.0\WebDev.WebServer40" />

<add key="iisExpressPath" value="C:\Program Files (x86)\IIS Express\iisexpress" />

Starting Visual Studio Development Server (Cassini Web server)

You can use the static Start method of the WebDev class in the Trackyon.CUIT.Helpers namespace.  The Start method takes two parameters port and path. Port is the port you want the web server to use to host your application.  Path is the path to the project to load.  The WebDev class provides a helper method FindProjectFolder that given the TestContext and Project Name will determine the path for you at runtime so the path is not hard coded.  Hard coding the path would require all developers to map the project to the same location on their machines.  The example below would start the MyWebApp project of the currently loaded solution on port 8081.

WebDev.Start(8081, WebDev.FindProjectFolder(TestContext, "MyWebApp"));

Once the test run is complete simply call Close to stop the server. 

Starting IIS Express

The IISExpress class also provides a static Start method, however, this method only takes a single parameter sitename.  The site name must map to a site already configured in your applicationhost.config file.  The site would be configured in the applicationhost.config file if you have setup your project to use IIS Express from the Web section of the project properties.  This file can be located in one of the two following locations:

%userprofile%\documents\iisexpress\config\applicationhost.config

%userprofile%\my documents\iisexpress\config\applicationhost.config

The example below would start the MyWebApp site in IIS Express.

IISExpress.Start("MyWebApp");

Once the test run is complete simply call Close to stop the server.

Known Issues

  • The icons for the servers may stay in Notification Area after the server has been closed.  Simply hovering your mouse over the icons will make them disappear.
  • The servers will close after the test is complete regardless if you call close or not. They are created as child processes of the test assembly and when the test are unloaded the process is terminated.
Comments are closed