2
votes

I have been working to get a SpecFlow framework in place for my Test environment, now I'd like to extend the ability to use this for multiple environments. I was wondering if I could do this with BeforeFeature so that I can use Tags to say which environment I want to run, and which tests I'd like to be able to do on any/each environment. Part of the problem I have in figuring this out is one of the Feature Scenarios I have to run contains an example table that will have different values for Test and Local.

Can I set up something like this in my Step Definition file?

    [BeforeFeature("Test")] 
    public static void BeforeFeature_Test() 
    { 
        setupEnvironment("Test"); 
    } 


    [BeforeFeature("Local")] 
    public static void BeforeFeature_Local() 
    { 
        setupEnvironment("Local"); 
    } 

If I have the tags @Test and @Local set up in my Feature files can I run BeforeFeature like this to get the correct settings I might need for my tests or environment?

With the Example Table I have something like:

Then I should be able to access <weblinks> pages 
    @Test 
    Examples: 
            | weblinks                          | 
            | http://test/url1                          | 
            | http://test/url2| 

    @Local 
    Examples: 
            | weblinks                          | 
            | http://local/url1                          | 
            | http://local/url2 | 

Can the @Test and @Local tags work for both the Feature tests I want to run and the example tables?

I'm running this in NUnit, and I have my configuration set up with allowRowTests="false" as I noticed someone mentioned on the list before, but that may have been in an earlier SpecFlow, I am using 1.8 in Visual Studio 2010 with WebDriver and C#.

1

1 Answers

-1
votes

It looks like I can do this, it just took me a bit to understand how to link the two together. The Setup issue is separate, and still an issue, than the Examples issue, but I know how to work the table issue out.