How do you approach Selenium tests in multiple browsers?

2,349 views
Skip to first unread message

jamescrowley

unread,
Jul 16, 2012, 11:09:24 AM7/16/12
to spec...@googlegroups.com
This isn't necessarily SpecFlow specific but when using vanilla NUnit with Selenium, I'd just use generic test fixtures to parameterize my tests for multiple browsers. 

How do people approach this when using Specflow (and TeamCity)? We'd want all our tests to be run under these multiple browsers. I could just set at an app.config level but then our build server would have to re-write these configs for each supported browser scenario? Just curious if there's a nicer way I'm missing here...

Thanks!

James

Oscar Rieken

unread,
Jul 16, 2012, 11:25:53 AM7/16/12
to spec...@googlegroups.com
you can pass in a parameter with the browser name and then in your setup make it catch that variable and pick the correct driver

I think depending on how you are building you project you might need a different config file for each browser. im not sure

jamescrowley

unread,
Jul 17, 2012, 4:28:33 AM7/17/12
to spec...@googlegroups.com
Yeah, for now I've had to just create some build steps that change the config file and then run the tests again - once for each browser. Works for now, but would be interested to know if there's a nicer route for this kinda thing in SpecFlow.

Gáspár Nagy

unread,
Jul 17, 2012, 10:09:58 AM7/17/12
to SpecFlow
In SpecRun you can create test execution profiles where you can
encapsulate the config transformations with the other execution
details. It cannot run the same tests with different configurations
though, so you need a separate profile for each browser. See www.specrun.com
for details.

Br,
Gaspar

div n

unread,
Nov 10, 2016, 5:25:48 AM11/10/16
to SpecFlow
HI Gaspar,
              I am using Specflow integrated with selenium.Wanted to know if it is possible to run same test suite on different browsers.Either parallely or linear. ie. first in IE,then chrome ,and then FF etc.But the test case suite will be the same?

Andreas Willich

unread,
Nov 14, 2016, 8:02:23 AM11/14/16
to SpecFlow
Hi

It is using the SpecFlow+Runner to use different browser for the same test suite.

Best regards
Andreas

--
You received this message because you are subscribed to the Google Groups "SpecFlow" group.
To unsubscribe from this group and stop receiving emails from it, send an email to specflow+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Erik

unread,
Nov 23, 2016, 3:56:21 PM11/23/16
to SpecFlow
Looking at the example project, it doesn't seem to support re-use of browser session across scenarios.  Can you think of a way to combine browser re-use for an entire target, then switch when a new browser target begins?

Andreas Willich

unread,
Nov 29, 2016, 5:27:36 AM11/29/16
to SpecFlow
Hi Erik

Yes, the example does not support re-use of the browser session. For every scenario a new browser is started.

To support it, you have to change WebDriver._currentWebDriver to static (so it survives multiple scenarios) and quit it in a AfterTestRun hook and not in a AfterScenarioHook.
The AfterTestRun hook is executed once for every target.

But be careful if you want afterwards to parallelize the execution. You will run into problems with the now static field.

Best regards
Andreas

On Wed, Nov 23, 2016 at 9:56 PM Erik <subrea...@gmail.com> wrote:
Looking at the example project, it doesn't seem to support re-use of browser session across scenarios.  Can you think of a way to combine browser re-use for an entire target, then switch when a new browser target begins?

--
Reply all
Reply to author
Forward
0 new messages