0
votes

Have 2 scenarios to run across 2 different users -

What I wish to achieve is as below, but not possible as cannot include 2 backgrounds in one feature

Background: Select User A - Scenario Outline: Validate clicking on link abc, xyz take me to 1 & 2 page.

Background: Select User B - Scenario Outline: Validate clicking on link abc, xyz take me to 3 & 4 page.

Have used Specflow Excel to handle the Scenario outline, but the Background step -have included as part of scenario, so this is being run for each scenario. I want the User to be selected once & the link check done against it. How implemented currently

Scenario Outline: Select User B - Validate clicking on link abc, xyz take me to 3 & 4 page.

Do we have @ BeforeScenario tags to do this?

 Scenario Outline: ABC Link check - Page
    When User searches for XYZ on ID field
    And User can access <Page>
    Then Control <Loc> with <Ctrl> displays

Scenario Outline: XYZ Link check - Page
    When User searches for XYZ on ID field
    And User can access <Page>
    Then Control <Loc> with <Ctrl> displays

@source:userNavigation.xlsx:SMSF
Scenarios:
|Page|Loc|Ctrl|

Want to push first When step to background steps. have 2 Examples defined here.

1
Sample specflow scenario please.lloyd

1 Answers

2
votes

It sounds like you need to use a Examples table and pass in parameters to check in the then statement along with the user.

Scenario Outline: Scenario name
.....
Then the user '<user>' sees the page '<page>'
Examples:
| user  | page  |
| userA | pageA |
| userB | pageB |