Can you run tests through both Goutte and Selenium

324 views
Skip to first unread message

John Brookes

unread,
Oct 25, 2012, 4:32:44 AM10/25/12
to be...@googlegroups.com
Behat uses the @javascript tag to route a scenario to Selenium; otherwise it is processed by Goutte (or whatever you are using instead).

Is there a way of setting up a scenario so it can run through either. depending on a setting made at run time?

I have a large number of tests which should work either way.  Normally I run them through Goutte for speed, but when the management come round they like to see the pages flashing up in the browser - it gives them more confidence that the system is working.  Without going through and duplicating the scenarios, is there a way to tell Behat to ignore the @javascript tag and run everything through Goutte?

I suspect this is something to do with the .yml file, probably around

  extensions:
    Behat\MinkExtension\Extension:
      show_cmd:  firefox %s
      base_url:  'http://local.soa.site.template'
      goutte:    ~
      selenium2: ~

but no idea how to change it.

Regards
John

po_taka

unread,
Oct 25, 2012, 7:11:08 AM10/25/12
to be...@googlegroups.com
add
default_session: selenium2

John Brookes

unread,
Oct 26, 2012, 5:11:07 AM10/26/12
to be...@googlegroups.com
Thanks for that - unfortunately I now have the opposite problem...

There are some scenarios which don't work in selenium - so is there a tag that forces a scenario to run through Goutte - an @no-javascript tag?

Regards
John

On Thursday, October 25, 2012 12:11:08 PM UTC+1, po_taka wrote:
add
default_session: selenium2

Christophe COEVOET

unread,
Oct 26, 2012, 5:47:05 AM10/26/12
to be...@googlegroups.com
You can force a given mink session with the @mink:<session> tag. So to force using the Goutte session, use @mink:goutte

-- 
Christophe | Stof

Matthieu Cornut

unread,
Jan 28, 2014, 10:24:29 AM1/28/14
to be...@googlegroups.com
Hi,

I have exactly the same problem. Did you finally find a way to specify the behat's driver at run time ?

For example by specifying the config profile with the right configuration...
bin/behat -p my_selenium_profile

Actually I didn't find any solution.
Using tag in the test feature is not satisfying, since my tests should run with goutte AND selenium.

Thanks

robocoder

unread,
Mar 5, 2014, 1:32:25 PM3/5/14
to be...@googlegroups.com
You can use the tag rewriter extension.  Tag the scenarios that require JavaScript with @javascript.  Use @no-javascript for the scenarios that can be driven by either goutte or selenium.

Create another profile in your behat.yml where the "no-javascript" is rewritten as "javascript".

Reply all
Reply to author
Forward
0 new messages