• 自动化测试 Cucumber


    Cucumber是一个能够理解用普通语言描述的测试用例的支持行为驱动开发(BDD)的自动化测试工具,用Ruby编写,支持Java和.Net等多种开发语言。

    Cucumber 三大组成:

    1. Features
    2. Step_definitions
    3. Cucumber command

    Feature是用简单的自然语言描述的。一个Feature有下面部分组成:

    • 一个title
    • 一段任意格式的描述语句
    • 任意数目的scenarios
    • 每个scenario可以包含任意数目的steps
    • Step定义必须以关键字Given, When, Then, And 开始
    • Feature文件必须以.feature为后缀名

    Step_definitions根据feature文件中定义的step编写对应的测试代码,所用编程语言可以和所测应用程序编程语言一致。

    Cucumber command, 当运行cucumber命令时,cucumber会分析feature文件中定义的step,然后去step_definitions寻找相匹配的step,如果找到就执行step中的代码。 执行命令,在命令行中输入cucumber项目目录features文件名.feature

    Cucumber 的开发过程(摘自http://cukes.info/):

    1: Describe behaviour in plain text

    Feature

    2: Write a step definition in Ruby

    Calculator Steps

    3: Run and watch it fail

    Failing output

    4. Write code to make the step pass

    Feature

    5. Run again and see the step pass

    Pending output

    6. Repeat 2-5 until green like a cuke

    Passing output

    7. Repeat 1-6 until the money runs out

  • 相关阅读:
    Vxlan基础理解
    ODPS基础
    关系型和非关系型数据库的区别?
    交换机的互连技术
    MYSQL 查看最大连接数和修改最大连接数
    Ceph添加/删除Mon(ceph.conf)
    java 线程的几个注解
    UML建模之类图
    单例模式的N种写法
    java工具jar包—Lombok
  • 原文地址:https://www.cnblogs.com/LilianChen/p/4034939.html
Copyright © 2020-2023  润新知