Specflow: maintain a single example table for many script paths

Is there a way to save the “Examples” data table in a separate file from the script schema?

I am trying to execute the entire script once in a browser one by one.

This works for me with the following function:

Feature: OpenGoogleInChrome

Scenario Outline: Open Google in Chrome
    Given a browser '<browser>'
    When the browser points to 'https://www.google.co.uk/'
    Then the title should be 'Google'

Examples:
    | browser |
    | Chrome  |
    | Edge    |
    | Firefox |

But that would mean keeping the example table in each individual test if I added another browser. Can I refer to one “Examples” table from each scenario schema?

Or call the script schema complete with a table of examples from the step definition?

(Using Specflow and Selenium WebDriver with NUnit)

"" , , -, . , , - (.feature) .

, , @Chrome, ( ), , , .

+4
3

, specflow ( ). , , , , , , , .

() , , , script, ( , ), , .

0

SpecFlow . , Bookstore, , , .

@Chrome @Firefox @IE    # <- feature wide, applicable for all scenarios
Feature: Open Google

Scenario: Open Google in the browser
    Given the browser is active
    When I navigate to "https://www.google.co.uk/"
    Then the title should be 'Google'

@Lynx    # <- additional browser for a specific scenario
Scenario: There is a Search button
    Given the browser is active
    When I navigate to "https://www.google.co.uk/"
    Then I should see a button with label "Search"

testrunner /.

0

, , . Given Environment.GetVariable("...") .

, . Given.

, , , , . , .

<appSettings> Visual Studio . NUnit :

nunit-console nunit.tests.csproj /config:Firefox
nunit-console nunit.tests.csproj /config:InternetExplorer
nunit-console nunit.tests.csproj /config:Chrome
nunit-console nunit.tests.csproj /config:Safari

, , .

0

Source: https://habr.com/ru/post/1613221/


All Articles