On Wednesday, December 6, 2017 at 10:19:09 AM UTC-8, Arik Jones wrote:
>
> You could create a browser session in `features/support/env.rb` and assign 
> it to an instance variable
> and then use that session in your feature files. Its basically a global 
> hook, but you'll need to end that session properly with an `at_exit` method.
>
> More info here: 
> https://github.com/cucumber/cucumber/wiki/Hooks#global-hooks
>
> Personally I don't recommend running your features that way.  Can I ask 
> why you need to do it this way?
>
> On Wednesday, December 6, 2017 at 8:32:35 AM UTC-6, 江南 wrote:
>>
>> Hi,
>>
>> I am using Watir Ruby + Cucumber for my testing. 
>>
>> Can you tell me how to run two feature files in one web session?
>>
>> Thanks
>>
>
That's where (in the env.rb file) I normally create the browser object when 
using Cucumber.. 

Performance wise that is highly preferable to creating and destroying a 
browser instance for each scenario, which can add quite a bit of overhead 
to your tests.  You may want a step that clears cookies, or loads a 
standard cookie for tests where that can matter, then include that as 
needed to simulate a 'clean-start' on the browser when required.

Unless you want to type out a really long command line with each feature 
file specified, using Tags is generally the easiest way I have found to 
have cucumber execute multiple scenarios from multiple feature files.  

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to