繁体   English   中英

如何使用pycharm在生菜中实现方案大纲

[英]How to implement a scenario outline in lettuce using 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

但是当我执行这一步时,我有以下信息:

在此输入图像描述

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

提前致谢!

我刚刚找到了自己问题的答案:

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

希望它有助于未来!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM