I'm working on setting up a SpecFlow project to test a portal. Thus far I've haven't had issues writing some "hello world" features and steps. My question is as the testing project grows, what is the best way to have the features run against a set of browsers?
Here are some solutions I've been able to come up with or see examples of online:
The browsers can be passed in as Examples for each Scenerio (Source), but this seems like it would bloat the Scenerio.
I looked into Tags and BeforeScenerio hooks, but that doesn't allow multiple browsers to be tested as the steps wouldn't be executed against each tag.
Setting the driver set in a static helper and depending which you want to run, the code can be commented/uncommented (Source). I probably wouldn't have it be commented out code, but abstract it into some Setting/Factory class. It would still be a code change though.
Following with the option above, the driver could be selected on a build variable (
#if IETESTING, etc), but I thought I once came across some statements claiming that these could be considered anti-patterns.
My final thoughts would be that the feature/gherkin files should not change to test different browsers for the great majority of cases as most features shouldn't have a browser requirement (exceptions could be newer HTML5 APIs & their fallbacks). I believe if they were controlled by some configuration that could be applied after compiling would preferable, but I'm unclear how best to accomplish this.