WebAii� DocumentationLanguage Filter
C# VB

Go back to ArtOfTest homepage.
logo
Skip Navigation Links.

Looking for a topic you can't find here? Feel free to let us know.

WebAii and Design Canvas and TeamCity

1    What is TeamCity

TeamCity is a Distributed Build Management and Continuous Integration Server. The Server automates the integration process by monitoring the team's source control repository directly. Every time a developer commits a new set of modifications, the server will automatically launch an integration build to validate the changes. When the build is complete, the server notifies the developer whether the changes that they committed integrated successfully or not.

TeamCity runs under the Apache Tomcat server as a JavaServer application. There are two integral parts to TeamCity that provide continuous integration services:

  1. The main server ' This part runs on a machine and monitors the source code control repository for new check-ins. When it see's one it automatically fires off a build. Because it's based on JavaServer pages you must have a JRE installed on the machine.

    It also is a web server that wants to run on port 80 by default. Be sure it does not conflict with IIS if you have that installed on your machine. During installation you have the option of selecting a different port number for the web server to operate under. You can use this to your advantage if you really want to run both IIS and TeamCity on the same machine.
  2. The build agent ' This component can run on the same box as the server or a different machine altogether. Because it's a Java application, you must have a JRE installed on the agent machine

    The server doesn't perform the actual builds and unit testing at all. Instead it contacts an available agent (or one that meets certain criteria you may specify in your project configuration) and instructs it to start a build. You can have a fleet of agent machines doing builds and communicating build status back to the server. The server keeps track of what's running and any user (with access) can look at that status at any time via the web server.

For more information about what TeamCity is and isn't and how to obtain it refer to their website at http://www.jetbrains.com/teamcity.

It's pretty easy getting your test code to build using TeamCity but there are a couple of tricks to getting it to run your WebAii tests as unit tests. Don't fear however, the way to get your tests to run and the results displayed by the web server is all done via the administration section on the web server.

2    Creating a project

This paper was written referencing TeamCity version 4.0.2. Hopefully whatever version you're running is compatible with what I'm about to describe. Also to understand the changes I'm about to describe you need to have a basic understanding of how to create and configure projects in TeamCity.

2.1   Adding a task project

Create your project just like you would any other project in TeamCity. What's important during the configuration process is to select one of the slnNNNN build runners (sln2003, sln2005, or sln2008).

Option Description
Build runner Select sln2008 from the drop-down list.
Solution file path Specify the path to the solution to be built relative to the Build Checkout Directory. For example:
vs-addin\addin\addin.sln
Working directory Specify the Build Working Directory. (optional)
Targets Specify the Microsoft Visual Studio 2008-specific targets. The possible options are Build, Rebuild, Clean, Publish or a combination of these targets based on your needs. Multiple targets are space-separated.
Configuration Specify the name of MS VS 2008 solution configuration to build.
Platform Specify the platform for the solution. You can leave this field blank, and TeamCity obtains this information from the solution settings.

2.2       Configuring MSTest test runner settings

The program that runs VisualStudio unit tests is Microsoft's MSTest utility. This utility comes with VisualStudio. It is a command line utility. It has many command line options for specifying what project to run, what tests in that project to run, and where to log the results to.  For more information about MSTest including command line options go to http://msdn.microsoft.com/en-us/library/ms182486(VS.80).aspx.

If you're using NUnit be sure to configure the NUnit test runner settings.

MSTest Settings Description
Run MSTests Check the box to enable running MSTest tests. If the option is not checked only NUnit test runner will be used.
Path to MSTest.exe A path to MSTest.exe file. By default Build Agent will auto detect the MSTest installation. One may use %system.MSTest.9.0% to refer to found MSTest path.
MSTest assemblies A list of assemblies to run MSTests on. Will be mapped to /testcontainer:file argument.
MSTest metadata Enter a value for /testmetadata:file argument.
Testlist from metadata to run Every line will be translated into /testlist:line argument.
Test Names of the tests to run. This option will be translated to the series of /test: arguments. Check Add /unique command line argument to add /unique argument to MSTest.exe.
Results file Enter a value for /resultsfile:file commandline argument.
Additionalcommandline parameters Enter an additional command line parameters for MSTest.exe.

2.3   Running the build agent

Before running the build agent, be sure that WebAii and/or Designer Canvas is installed on your build agent machine.

Now you're ready to run your TeamCity build agent and let it start building and running tests. The TeamCity build agent can be run in two modes:

  • Command line mode
  • Windows service mode

There is a problem with using Windows service mode. WebAii tests require the browser be able to run and interact with the desktop. When running builds and tests under a Windows service, desktop interaction is disabled.  As a result virtually no WebAii test can successfully run in this environment.

It is best to log onto your server using an account that has access to your source control and VisualStudio permissions and start the TeamCity server in command line mode. Leave this user logged on all the time. If you logoff this user the TeamCity server will shut down and you won't get any builds.

Most WebAii unit tests work just fine if you leave the computer locked (displaying the logon screen) so long as TeamCity is running under a user account with desktop interaction privileges (which all regular users have). The only tests that may have a problem with this are those that interact directly with the desktop (Mouse.Click, Window.GetBitmap, etc.). Tests that exclusively interact directly with the Browsers DOM will run just fine this way. Unfortunately there's no way around this. This is simply the way that Windows works.

In order for WebAii tests that interact directly with the desktop to work you'll need to leave your TeamCity build agent machine logged on and displaying the desktop all the time. This means you'll have to disable the screensaver and never lock the computer. Yes this does present a security risk to your company.  If you can lock this computer up into a secure room (such as a datacenter) you can minimize this security risk.

To run the build agent in console mode follow these steps:

  1. Locate the build agent's bin folder. The default is C:\TeamCity\buildAgent\bin.
  2. Open a command prompt window.
  3. Change to the bin folder you just located.
  4. Enter 'agent start'. A new console window will open with the agent running inside of it. Your command prompt window will return to a command prompt and may be closed now if you desire.

You can attempt to run more than one build agent on the machine but it won't actually work. Only one of them will be active and communicating with the TeamCity server. In addition WebAii and Designer Canvas are not thread safe. They will conflict with each other if you try to run multiple tests in parallel on the same machine.

Copyrights © 2007-2009 ArtOfTest, Inc. All rights reserved. Privacy Policy | Terms of Use