Sunday, February 14, 2010

Integrating SLIM+Fitnesse with CruiseControl

On the current project we use SLIM framework within FitNesse for Acceptance testing. We rely quite heavily on the Fitnesse tests results to certify our builds. Hence it was important for us to automate running our SLIM tests and to properly publish the result in the cruise page.
I use the ant scripts to execute Fitnesse test runner from a command-line, parse the resulting XML and transform it using style sheet and finally write the results to the xml files in the cruise log directory. Сonsequently the CruiseControl dashboard with the results looks like here


To have such view each suite should have its own xml log in an appropriate format. I do this just running each suite separately. For this purpose I use the names fitnesse command to get a list of the suites and then run them using the suite Fitnesse command, so it is pretty easy to save the results in the different files. If I don't need to run the whole bunch of the suites (for example: only suites of a particular virtual machine) I use the suiteFilter parameter of the suite command.



As you see the 'exec fit suite' target is a procedure that runs fitnesse against the given suite and store it's output into the 'suite_result' property. After that there is a small trick. Unfortunately, the output contains not only test's result in the xml format, but also the fitnesse command output
FitNesse (v20100103) Started...
 port:              9125
 root page:         fitnesse.wiki.FileSystemPage at C:\FitNesse/FitNesseRoot
 logger:            none
 authenticator:     fitnesse.authentication.PromiscuousAuthenticator
...
Exit-Code: 0
So, it is necessary to filter it and here only strings between <testResults> and </testResults> are written to the logs.
As I already have said, the suiteFilter parameter of the suite command is used to run only particular suites. In  this case fitnesse tries to execute each suite but if it does not fit for the given criterion it's tests do not start but we have the xml output as well. Such output does not have relativePageName tag, so in the 'save log as xml ' I just check it and write xml logs only for suites that were really ran.

Pay attention to the 'xslt' ant's task in the 'save log as xml'target. It is used here to write fitnesse test's results in the particular format by processing they via the XSLT.

That's it for today. Feel free to ask me questions.

Tuesday, February 9, 2010

Problems use runProgramInGuest in Windows 2008

I meet a problem when use runProgramInGuest method of vmrun to run Acceptance Tests for my product in Windows 2008 os on the ESXi 4.0.0 server. The problem is that I can't see any active window in the windows 2008 console and as a result it is hard to develop and support user interface acceptance tests. It happens because of a program invoked by RunProgramInGuest is running under session 0 that is non-interactive. It is made in order to better protect the system against security risks. But what if a session 0 service needs to interact with the user? For example : a backup program wants to inform the user that it cannot start an automated backup because the external USB hard drive is disconnected. For this purpose there is the Interactive Services Detection Services (UI0Detect). It can be invoked by the service that needs to interact with the user. UI0Detect in turn presents to the user a window telling him that a particular service needs some interaction. The user gets two choices : "Show me the message", or "Remind me in a few minutes".



Clicking "Show me the message" switches the display to the service which wanted to interact with the user. By default, the startup mode of this service is Manual. Just use command below in cmd to change this mode.

sc config UI0Detect start= auto

So this very gracefully solves my problem and I'm happy - my product will be tested in windows 2008.