BDD Шаг уже связан и нанесен на карту - PullRequest
0 голосов
/ 05 марта 2020

Я буду признателен, если кто-то поможет, как справиться с такой ситуацией.

У меня есть сценарий:

 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    | test3@domain.co.uk |

В том же проекте, когда я добавляю другой сценарий для другого модуля, например

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 |

Для шага When Enter the <Email> в сценарии 1 у меня есть следующая реализация

[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;
            }           

        }

Но когда я пытаюсь сгенерировать определение шага для 2-го сценария, я не могу сгенерировать для следующие шаги

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

И получил сообщение, что все шаги связаны. Эти шаги сопоставлены с моим методом, упомянутым ранее

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

Я пытался получить помощь от Google, но не смог найти. Любая помощь будет высоко оценена.

1 Ответ

1 голос
/ 05 марта 2020

Шаги в SpecFlow , а не , специфицирующие c для функции. Они глобальные для тестового проекта. У вас может быть только одно определение на шаг.

Если вам нужно более одного определения на шаг, рассмотрите возможность добавления большего количества параметров к шагу или сформулируйте шаг так, чтобы он был более конкретным c для варианта использования в применение.

...