2015-02-23 108 views
0

实现生菜方案大纲,我有以下特点:如何使用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 

但是当我执行这一步我有跟随着信息:

enter image description here

我检查生菜文件和场景大纲看起来相当不错,但我仍然不明白我做错了什么。有任何想法吗?

在此先感谢!

回答

0

我只是找到了答案,以我自己的问题:

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 

希望这有助于在未来!