behave是行为驱动的开发,python风格,behave-py3是一个支持python 3的个人分支,希望能合并回上游。

behave-py3的Python项目详细描述


Travis CI Build StatusLatest VersionDownloadsLicense

行为是行为驱动的开发,python风格。

logo

行为驱动开发(bdd)是一种敏捷的软件开发。 鼓励开发人员、qa和 软件项目中的非技术或商业参与者。

behave使用由python支持的自然语言风格编写的测试 代码。

首先,install *behave*.

现在创建一个名为“features/”的目录。 在该目录中创建一个名为“example.feature”的文件,其中包含:

# -- FILE: features/example.featureFeature: Showing off behave

  Scenario: Run a simple test
    Given we have behave installed
     When we implement 5 testsThen behave will test them for us!

创建一个名为“features/steps/”的新目录。 在该目录中创建一个名为“example_steps.py”的文件,其中包含:

# -- FILE: features/steps/example_steps.pyfrombehaveimportgiven,when,then,step@given('we have behave installed')defstep_impl(context):pass@when('we implement {number:d} tests')defstep_impl(context,number):# -- NOTE: number is converted into integerassertnumber>1ornumber==0context.tests_count=number@then('behave will test them for us!')defstep_impl(context):assertcontext.failedisFalseassertcontext.tests_count>=0

跑步行为:

$ behave
Feature: Showin off behave # features/example.feature:2

  Scenario: Run a simple test# features/example.feature:4
    Given we have behave installed     # features/steps/example_steps.py:4
    When we implement 5 tests          # features/steps/example_steps.py:8
    Then behave will test them for us! # features/steps/example_steps.py:13
1 feature passed, 0 failed, 0 skipped
1 scenario passed, 0 failed, 0 skipped
3 steps passed, 0 failed, 0 skipped, 0 undefined

现在,继续阅读,学习如何最大限度地行为。为了开始, 我们推荐tutorialfeature testing language以及 api引用。

更多信息

测试域

behave和其他bdd框架允许您提供step库 在解决相同问题的类似项目中重用步骤定义 问题域。

目前已知支持以下测试域:

Testing DomainNameDescription
Command-linebehave4cmdTest command-line tools, like behave, etc. (coming soon).
Web Appsdjango-behaveTest Django Web apps with behave.
Web, SMS, …behavingTest Web Apps, Email, SMS, Personas (step library).

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java将一个节点拖到另一个不运行JavaFX的节点中   java如何在spring boot中创建完全自定义的查询   java Arraylist和ArrayListBlockingQueue之间的区别是什么?   java Weblogic会中断长时间运行的线程吗   java如何调用displayAd()方法?   使用数组在两个组之间进行java IPL匹配   java如何在Eclipse中的org下创建测试套件。朱尼特   java获取屏幕上任意点的鼠标坐标   正则表达式需要java正则表达式方面的帮助   如何使用Java获取Ram大小和硬盘大小?   java如何将所需长度设置为数组中的整数?   安卓应用程序启动前的java程序已终止   swing设置要在Java代码中打印的页边距   迭代期间java故障安全迭代器的删除   java如何在main中调用方法,以便它们在同一行上输出?   编译Java:尝试播放mp3文件时出错   java如何使用Spring数据Rest在POST调用中保存嵌入对象   java JAXWS如何在端点外部注入SecurityContext