views:

514

answers:

2

I have a Fitnesse.NET acceptance test suite that I want to run as part of my TFS/MSBuild CI build.

The suite contains some Fitnesse variables that I need to override when calling from the build process, eg:

!define ConnectionString {Data Source=...}

How can I override the variable values defined in the suite when calling the suite from the command line test runner?

I'd like to be able to do something like:

Tests\TestRunner.exe -v -results test.results localhost 8082 MyTestSuite -P:ConnectionString={MyBuildServerDB}

Any ideas?

+1  A: 

Im not sure of a way to pass one into the runner, but you could make symbolic pages that define your variables differently and then you just call the different page. For example in our setup we can run our tests with in-memory repositories or with MySQl as the database. This allows us to run the entire suite very fast and then CI can run the slow ones.

So we have two pages that contain a symbolic link. The properties looks like this:

<?xml version="1.0"?>
<properties>
    <Help></Help>
    <LastModified>20090427102431</LastModified>
    <Search/>
    <Suite/>
    <Suites></Suites>
    <SymbolicLinks>
     <MustPass>.FrontPage.MustPass</MustPass>
    </SymbolicLinks>
    <saveId>1231186112073</saveId>
    <ticketId>3122308994585074329</ticketId>
</properties>

and the contents looks like this:

!define repository_type {InMemory}

This is the test suite for in-memory tests. Run this instead of running the !-MustPass-! suite.

!contents -R2 -g -p -f -h

Then the runner can get the pages to run as a param something like this:

.\dotnet\TestRunner -format xml -results results.xml localhost 8080 FrontPage.MemoryMustPass
ryber
Genius! That's exactly what I need. ThanksSee the Fitnesse UserGuide for more info on Symbolic links: http://fitnesse.org/FitNesse.UserGuide.SymbolicLinks
David Laing
+3  A: 

The symbolic link trick of the first answer works nicely.

Another solution is to use environment variables or java variables. Any environment or java variable can be accessed from a fitnesse page as though it was a variable. So if you have ${MYVAR} on a fitnesse page, and you have a MYVAR environment or java variable, then it will use the value of the environment or java variable.

Uncle Bob
I wish there was a section on the FitNesse site to demonstrate that feature! :)
Brett Veenstra