Как реализовать схему сценария в салате с помощью pycharm

У меня есть следующая особенность:

Feature: Check if the weather service works properly
In order to check the weather service
As beginner
I'll get some values and check if they are ok and if the temperature given is correct

Scenario: Check if a city and and country given are correct
     Given I access the url with http://api.openweathermap.org/data/2.5/weather
     And the city is <city> and the country <country>
     When I ask for the city and country name
     Then I check if the city and country are correct
     And I check if the status code is 200

  Examples:
    | city      | country |
    | London    | UK      |
    | Madrid    | ES      |
    | Barcelona | ES      |
    | Berlin    | GE      |

И у меня есть следующий шаг:

@step("the city is (.*) and the country (.*)")
def city_and_country(self, expectedCity, expectedCountry):
    world.expectedCity = expectedCity
    world.expectedCountry = expectedCountry

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

введите здесь описание изображения

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

Заранее спасибо!


person SomeAnonymousPerson    schedule 23.02.2015    source источник


Ответы (1)


Я только что нашел ответ на свой вопрос:

Scenario Outline: Check if a city and and country given are correct
Given I access the url with http://api.openweathermap.org/data/2.5/weather
And the city is <city> and the country <country>
When I ask for the city and country name
Then I check if the city and country are correct
And I check if the status code is 200

Examples:
  | city      | country |
  | London    | GB      |
  | Madrid    | ES      |
  | Barcelona | ES      |

И определение шага:

@step('the city is ([^"]+) and the country ([^"]+)')
def city_and_country(self, expectedCity, expectedCountry):
    world.expectedCity = expectedCity
    world.expectedCountry = expectedCountry

Надеюсь, это поможет в будущем!

person SomeAnonymousPerson    schedule 24.02.2015