Skip to content

Cory Foy

Organizational agility through intersecting business and technology

Menu
  • FASTER Fridays
  • Mapping Mondays
  • Player Embed
  • Search Videos
  • User Dashboard
  • User Videos
  • Video Category
  • Video Form
  • Video Tag
Menu

FitNesse DoFixtures and Gojko’s DbFit

Posted on April 17, 2008 by Cory Foy

Things have been kind of quiet on my front because of how crazy things have been at work. But in a good way. One of the things I’ve been doing is introducing FitNesse as an integral part of our strategy for capturing business rules and domain logic that isn’t really being captured anywhere.

Currently I’m working on some characterization tests around one of our legacy transaction systems. Basically a component calls our web service, which processes the request and then updates the database. I’ve been using a DoFixture with the .NET version of FitNesse to capture the steps. When it came time to test the database, I knew I wanted to use Gojko’s DbFit fixtures.

So far, they’ve been great. The hiccup was that I needed to integrate them into my existing DoFixture flow. However, using the handy property of DoFixtures to be able to return other fixtures, I’ve got it working.

The test would look something like:

!|MyTestFixture|

|Set Blog To|http://www.cornetdesign.com|

|Add Link To Blog With Username|Cory|And Password|Password|

|import|
|dbfixture.fixture|

|DatabaseEnvironment|ORACLE|
|Connect|MYDB|username|pw|

|Ensure Link Was Added To Database With Query|SELECT LinkUrl FROM Links|
|LinkUrl|
|http://www.cornetdesign.com|

The code for the db method would look like:

public dbfit.fixture.Query EnsureLinkWasAddedToDatabaseWithQuery(string query)
{
  return new dbfit.fixture.Query(dbfit.DbEnvironmentFactory.DefaultEnvironment, query, false)
}

Two great tastes that taste great together.

3 thoughts on “FitNesse DoFixtures and Gojko’s DbFit”

  1. Anonymous says:
    April 24, 2008 at 7:08 pm

    Hi Cory, I followed one of your earlier entries in combining fitnesse with selenium RC, and now I’m just about to start investigating if I can use DbFit to verify some data exists in a db before using it to log into a website – I’m sure I’ll hit some pitfalls on the way, but I just wanted to say thanks for the help you’ve provided so far!

    After I get past this I might have to experiment with combining Selenium IDE to automatically create scripts that can be read by Fitnesse – would be great if I ever get to that point!

  2. Christian Baumann says:
    August 30, 2011 at 10:29 am

    Thx Cory,

    that´s exactly what I´ve been looking for!

    Regards,
    Christian

  3. Christian Baumann says:
    August 31, 2011 at 6:33 am

    Hi,

    I´ve tried to use this for my tests, where I want to do something like this:

    !|MyTestFixture |
    |Set Blog To |http://www.cornetdesign.com |
    |Add Link To Blog With Username|Cory |And Password |Password |
    |check |ResultOfQuery|SELECT LinkUrl FROM Links|equals|http://www.cornetdesign.com|
    |Do Something Else |

    Means I want to use the SQL query and check for it´s result in a line of my DoFixture test.
    To do so I need to modify ResultOfQueryEquals() so that only the result of the query without any headers gets returned (as list or array or something), but I can´t really figure out how (still a C# newbie).
    Any idea/ advice on this?

    Thx in advance,
    Christian

Comments are closed.

© 2025 Cory Foy | Powered by Superbs Personal Blog theme