首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >生菜背景,django

生菜背景,django
EN

Stack Overflow用户
提问于 2013-08-30 04:27:42
回答 1查看 865关注 0票数 1

我如何在莴苣测试(Django)中编写背景,背景在每个场景之前运行,在黄瓜中,我可以编写这样的背景:

代码语言:javascript
复制
Feature: Multiple site support
  As a Mephisto site owner
  I want to host blogs for different people
  In order to make gigantic piles of money

  Background:
    Given a global administrator named "Greg"
    And a blog named "Greg's anti-tax rants"
    And a customer named "Dr. Bill"
    And a blog named "Expensive Therapy" owned by "Dr. Bill"

  Scenario: Dr. Bill posts to his own blog
    Given I am logged in as Dr. Bill
    When I try to post to "Expensive Therapy"
    Then I should see "Your article was published."

  Scenario: Dr. Bill tries to post to somebody else's blog, and fails
    Given I am logged in as Dr. Bill
    When I try to post to "Greg's anti-tax rants"
    Then I should see "Hey! That's not your blog!"
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-08-30 04:39:19

例如,您可以在生菜中使用Background (取自这里):

代码语言:javascript
复制
Feature: Simple and successful
  As the Lettuce maintainer
  In order to make sure the output is pretty
  I want to automate its test

  Background:
    Given the variable "X" holds 2

  Scenario: multiplication changing the value
    Given the variable "X" is equal to 2
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18524915

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档