Gherkin: behave feature 描述语言

Gherkin: Feature testing Language

Behave使用的是一种叫做Gherkin的自然语言来描述。它允许非技术人员参与到业务开发中。

Feature 格式

Feature: feature name  // 这里我们要简单写一下这个功能的名称,概述。
  In order xxxxxxxxx,  //为了达到什么目的
  As     yyyyyyyy       //作为一个什么角色
  I want zzzzzzzz       //我想要干什么
 
Scenario Outline 格式

   Scenario Outline: Calc fib number    //场景大纲
     Given we have the number <number>    //交互前的系统状态,准备数据或者环境
      when we calc the fib                //交互,用户执行的关键行为,它可能会导致某些系统状态改变
      then we get the fib number <fib_number>          //观察结果
      

additional “and” or “but” steps may also follow the “given”, “when” and “then” steps if more conditions need to be tested. 

"and"和"but" 可能被跟随在"give""when""then" 后面来满足复杂场景的需要。

Examples 格式;
      Examples: Some Numbers
        | number    | fib_number |
        | 1         | 1          |
        | 2         | 25         |
        | 10        | 515        |
        | 11        | 661         |    
        
        
Tags
我们可以使用Tags来允许部分feature
      @sub
      Examples: Some Numbers
        | number    | fib_number |
        | 1         | 1          |
        
运行behave --tags=sub 可以只运行这个tag下面的example数据。

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值