Running a Feature multiple times (e.g. per Browser)

Oct 23, 2013 at 2:13 PM
Edited Oct 23, 2013 at 2:17 PM
So if I was composing antipatterns and wanted to run a given set of Features against all browsers, is there
a) a Gherkin (/TickSpec) intrinsic for that ? (kinda a Background Outline with an Example per browser)
b) would I do a custom TickFactAttribute which perms Browser against TickSpec.Feature instance, feeding in a <Placeholder> which could be used in a Background: in some way ?
c) any other ideas?
Oct 23, 2013 at 2:26 PM
Edited Oct 23, 2013 at 2:45 PM
You could use tags (like @ignore, you can define your own ones) on top of the scenarios you want to run in a specific way (I need to check if tags on features are currently supported, definitely work on scenarios - will get back to you on that one). If you're using the xUnit you could adapt the TickFact to run only the scenarios that match that tag.
Oct 23, 2013 at 10:06 PM
Edited Oct 23, 2013 at 10:07 PM
Thanks for the reply.

On (and the slides at, I see what I mean is:

Feature: Lots of browsing

    Given a browser <Browser>

Shared Examples:
Scenario: Browse home
    When I look at home
    Then I should see a page

Scenario: Browse about
    When I look at about
    Then I should see a page
module Steps = 
    let [<Given>] ``a browser (.*)`` browser = 
        printfn "Using %s" browser
    let [<When>] ``I look at (.*)`` page =  
        printfn "Look at %s" page 
    let [<Then>] ``I should see a page`` () =  
        printfn "see a page"
It does
home Chrome
home IE
home Netscape
about Chrome
about IE 
about Netscape
Now investigating Shared Examples of @tag ...
Oct 23, 2013 at 10:19 PM
Edited Oct 23, 2013 at 10:27 PM
Even better, Given
Feature: Lots of browsing

Shared Examples of @browser:
    |Netscape 2|
Shared Examples of @page:

@browser @page
Scenario: Titles must be Just So in all browsers
    When I look at <Page> in <Browser>
    Then I should see a page with Title <Page>
module Steps = 
    let [<When>] ``I look at (.*) in (.*)`` page browser =  
        printfn "Look at %s in %s" page browser
    let [<Then>] ``I should see a page with Title (.*)`` title =  
        printfn "see a page with title %s" title
Now that's one dangerous Golden Hammer!

(For the record, I tried for the sake of completeness to apply tags to Background and the Feature and it didnt do combinatorials for me. But IMO its no burden to put a set of tags per scenario in order to make things explicit.

But it does feed the Parameters from the Shared examples into Backgrounds so I can't actually imagine a valid scenario that doesn't work... for now)

Thanks Phil!
Marked as answer by bartelink on 10/23/2013 at 3:19 PM