Tuesday, June 15, 2010

Cruise Control .NET (ccnet) + NAnt + NUnit + White

We develop WPF application. This application has very simple UI but really complex logic. So we decided to write UI tests for it. We use White as UI test framework. White is just wrapper over UI Automation. It is pretty simple and powerful. Moreover it has source code so you can change whatever you want.

But White has one restriction. UI tests should be run in windows interactive mode. So this is the problem to run your tests on continuous build. Please look at this short article for details. There are two ways to avoid this restriction:
- use virtual machine like DMWare
- use TightVNC instead of standard Remote Desktop.

We decided to use TightVNC. It is freeware and we don't need to install additional operation system on virtual machine.

First of all you need to download TightVNC from their web site. Please be careful to install the same version of the server and viewer. Otherwise you'll get connection error.
Install TightVNC-server on your build server and TightVNC-viewer on your local box.

Connect to build server through TightVNC-viewer. If you have running ccnet as a service stop it. You need to launch ccnet just as console application. I didn't manage to run White tests when ccnet was running as a service. I tried to check "interact with the desktop" option in the service properties, tried to use different login accounts - nothing helped. Actually it's ok just to launch "C:\Program Files\CruiseControl.NET\server\ccnet.exe".
Finally don't forget to uncheck this option.



If you have correctly configured ccnet then that's all. If not I'll tell how to configure all this stuff.

We implemented following approach:
1. ccnet executes nant build through nant task.
2. nant builds project and executes nunit tests through exec task.
3. ccnet merges log of nunit with main log.

It seems that some issue in ccnet. It duplicates nunit log if you're using nunit task. I tried to use recommendations on their web site to avoid this. But without success.


ccnet.config

It launches nant build as executable and has 2 tasks as targets. One to compile project and second to run ui tests.
Then it merges nunit results into main log.

nant.build


This nant script just executes msbuild to build solution and then executes nunit to run tests. NUnit produces results into MyProject.Tests-results.xml. You can run this build both from ccnet process and standalone.

No comments:

Post a Comment