I have a set of preferences I want to test the exact same tests for, and make sure they all behave appropriately. So, the for loop would iterate over each preference configuration, and run the same set of tests is the previous and next iteration. *With IF statements of course, so tests that don't apply to the current configuration don't need to be tested.
Is there a way to do this / something simi开发者_运维技巧lar?
I'm using rails 2.3.8
It sounds like you want cucumber example tables, where you can enumerate all your Preference values you want to test the same behavior of:
Given I have a preference defined
When I do some thing
Then I should see this behavior
Examples:
| preference | label_name |
| foo | It's Foo! |
| bar | So bar... |
Here's a link to a tutorial using table based examples for testing like this:
http://asciicasts.com/episodes/159-more-on-cucumber
Cucumber has a concept called Scenario Outlines
that is used to describe a scenario that needs to be run repeatedly with differing data.
This sounds like something you use a scenario outline for:
https://github.com/cucumber/cucumber/wiki/Scenario-outlines
精彩评论