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附加两个数组   java如何在Extjs的不同页面中使用相同的存储   java Jung,大顶点的布局重叠,图形出现在奇怪的位置   java如何在Android中通过画布绘制圆?   java验证库设计模式选择   java研磨机未知标记“timedTests”   java Android领域子类实例方法   java使用resteasy/jaxrs从请求负载接收两种类型的数据   缓冲策略Java缓冲策略有时不能正确绘制   java跟踪棋子   密度无关像素如何在java中锐化图像缩略图?   java如何在MongoDB更新查询中编写(或)更新   java A*寻路游戏系统退出问题   java在安卓中读取xml的最佳方式是什么?   通过反射调用的方法的java抑制警告   安卓 java。语言错误:信号11(SIGSEGV),代码10(?),故障地址006e006f   java lombok 1.18.2使用DexBuilderForDebug抛出TransformClasses   java JOptionPane CD对话框按钮?   java只返回json中的一些值,而不是完整实体对象   java包不存在错误,请稍后重试