Khurram
Khurram

Reputation: 21

BDD Step already Bound and mapped

I will appreciate if someone help that how to handle such situation.

I have a Scenario:

 Scenario Outline:Modify Account Details
    Given AccountID is selected in The Quick Search
    When user enter the <AccountID> in search field
    And Click on Quick Search button
    And Close the Alerts
    And Click on Edit Link
    When Enter the <Email>
    And Click on Commit button
Examples: 
   | AccountID | Email               |
   | 116999    | [email protected] |

In the same project when I add an other scenario for different module like

Feature: Create a new Ticket
Background: 
Given I have entered the CRM URL
And AccountID is selected in The Quick Search
@mytag
Scenario Outline: Add a new Ticket
    Given user perform a quick search for <AccountID>
    When User click on Add New link on Ticket Section   
    And Select the <Department> and <SubTeam> from the list
    And Enter the <Subject> of the ticket
    And Select the <Product>
    And Select the <TicketCategory> and <TicketSubCategory>
    And Enter the <Comments> and <PersonSpokeTo>
    And Click on Finish
    Then A new Ticket is created

Examples: 
| AccountID | Department        |SubTeam| Subject     | Product        | TicketCategory     | TicketSubCategory | Comments      |
| 116999    | Customer Services | Contract Enquiries | Test Ticket | Home Insurance | Account Management | Customer Zone     | Test Comments |

For Step When Enter the <Email> in Scenario 1 I have the below Implementation

[When(@"Enter the (.*)")]
        public void WhenEnterTheEmail(string email)
        {
            try
            {             
                Helper.ExplicitWait(_driver, AccountDetailsEdit.xPathtxtEmailBilling, 90);
                AccountDetailsEdit.txtEmailBilling.Clear();
                Helper.EnterTextValue(AccountDetailsEdit.txtEmailBilling, email);

            }
            catch (Exception e)
            {
                Console.WriteLine("No Such element found -{0}",e);
                _driver.Quit();
                throw;
            }           

        }

But When I try to generate the Step Definition for 2nd Scenario I am unable to generate for the following steps

  And Enter the <Subject> of the ticket
  And Enter the <Comments> and <PersonSpokeTo>

And Got the message that All steps are bound. These step mapped with my method mentioned earlier

[When(@"Enter the (.*)")]
            public void WhenEnterTheEmail(string email)

I tried to google to get some help but unable to find. Any help will be highly appreciated.

Upvotes: 0

Views: 46

Answers (1)

Greg Burghardt
Greg Burghardt

Reputation: 18803

Steps in SpecFlow are not specific to a feature. They are global for a test project. You can only have one definition per step.

If you need more than one definition per step consider adding more parameters to the step, or phrase the step so it is more specific to a use case in the application.

Upvotes: 1

Related Questions