views:

241

answers:

1

I'm testing an app that's basically a message-handling application - a message comes in, it's content is analysed, then it's sent somewhere else for processing. The app isn't built in Ruby.

As you might imagine, the main testing approah consists of generating a whole bunch of different types of (quite complex) messages, loading them into the app, waiting a few seconds then ensuring that they get sent to the correct place.

Functionally, the testing's going well, but I've currently got all of the test messages & desired message destinations defined in Ruby code - I'd like to move them to either a YAML file, or (second choice) a database. I'd prefer to use a YAML file over a database because it's easier to version control, and for non-technical testers to edit the message content directly.

Is there a "recommended" way to implement this sort of data management in Cucumber? It sort of smells like a fixtures approach makes sense, but fixtures to me have always involved populating a database from a file and then using the DB for testing, and I'm not 100% sure this is the best/simplest fit for this particular problem.

+2  A: 

I believe what you will be most happy with is a Scenario Outline. You could perhaps create a yaml file an load it from a step, but that would not make a very useful test output. What you (I think) would really like is to see each message and its destination sorted by weather it passed or failed. The example below is for Failed Logins, but it gets the point accross.

Scenario Outline: Failed Login
  Given I am not authenticated
  When I go to "/login"
  And I fill in "login" with "<mail>"
  And I fill in "password" with "<password>"
  And I press "Log In"
  Then the login request should fail
  Then I should see an error message

  Examples:
    | mail           | password       |
    | not_an_address | nil            |
    | not@not        | 123455         |
    | [email protected]    | wrong_paasword |

Each Example will turn green, red or yellow depending on whether it worked, failed or was pending.

John F. Miller