项目主页:http://expectations.rubyforge.org/
安装的话:gem install expectations
它将测试分为state based和behavior based,语法很DSL,作者写了篇文章《implementing internal dsl in ruby》
例子,
state base test:
# State based expectation where a value equals another value
expect 2 do
1 + 1
end
expect /a string/ do
"a string"
end
# State based test checking if actual is in the expected Range
expect 1..5 do
3
end
# State based test to determine if the object is an instance of the module
expect Enumerable do
[]
end
# State based test to determine if the object is an instance of the class
expect String do
"a string"
end
# State based test to determine if the modules are the same
expect Enumerable do
Enumerable
end
behavior based test:
# Behavior based test using a traditional mock
expect mock.to_receive(:dial).with("2125551212").times(2) do |phone|
phone.dial("2125551212")
phone.dial("2125551212")
end
# Behavior based test on a concrete mock
expect Object.to_receive(:deal) do
Object.deal
end
分享到:
- 2008-02-16 10:05
- 浏览 1632
- 评论(1)
- 论坛回复 / 浏览 (1 / 2020)
- 查看更多
相关推荐
Mockito是一个针对Java的mocking框架。它与EasyMock和jMock很相似,但是通过在执行后校验什么已经被调用,它消除了对期望行为(expectations)的需要。其它的mocking库需要你在执行前记录期望行为(expectations),...
寄予厚望 小型ES5断言框架经验 与运行 node test.js
资源分类:Python库 所属语言:Python 资源全名:great_expectations-0.13.31.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源来自pypi官网。 资源全名:great_expectations-0.9.1.tar.gz
目的是允许dbt用户直接从dbt在其数据仓库中部署类似于GE的测试,而不必与他们的数据仓库添加另一个集成。安装包含在packages.yml packages : - package : calogica/dbt_expectations version : [">=0.2.0", "<0> ...
资源分类:Python库 所属语言:Python 使用前提:需要解压 资源全名:great_expectations-0.7.7-py2.py3-none-any.whl 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
python库。 资源全名:airflow-provider-great-expectations-0.0.7.tar.gz
一个 leiningen 插件,用于使用库编写运行测试。 用法 对于莱宁根 2.0: 在project.clj声明lein-expectations : :plugins [[lein-expectations " 0.0.8 " ]] 对于 Leiningen 1.x - 使用 lein-expectations 0.0.5...
Great,Expectations英文读后感(远大前程)参考.doc
《Step By Step写测试》介绍使用 JTESTER 写单元测试,作者吴大瑞,pdf 格式,大小 1.8MB。本书带有 pdf 书签,方便读者阅读。 目录: Jtester的项目配置 1 TestNG测试 1.1 一个简单到不能再简单的测试 1.2 在...
设计用于 mocha,但适用于任何测试框架。安装NodeJS: npm install expectations 浏览器:手动下载,或bower install expectations用法节点: require('expectations');// exports a global, so use anywhere来自 ...
python库,解压后可用。 资源全名:great_expectations-0.8.3-py2.py3-none-any.whl
great_expectations_sample PostgreSQL期望示例项目 使用命令行参数提供表/视图名称。可用于在运行时创建动态命令 与python /path/to/uncommitted/chkpt-1.py patient一起运行 这也创建了文档和结果 对于任何ge cli...
它与IDE自动补全功能相得益彰: 测试失败会显示清晰且有用的消息:用法首先,将超出期望作为对单元测试的依赖项添加到您的项目中: dub.sdl : configuration "unittest" { dependency "exceeds-expectations" ...
Smart grid expectations [In My View]
For each phase of software development, you will study specific techniques for improving the quality of products and you will read about the interactions and expectations of groups and organizations ...
Portfolio selection with coherent Investor’s expectations under uncertainty.pdfPortfolio selection with coherent Investor’s expectations under uncertainty.pdfPortfolio selection with coherent ...
框架:测试驱动开发简介 为什么我们要在我们的应用程序中实施测试? (5 分钟,0:05) 随着应用程序复杂性的增加,我们需要一个安全网。 我们需要一些东西来确保我们“不伤害”。 我们需要一系列自动化测试。 这些是...
rspec-expectations 提供一个简单,合理的 API 来表示示例代码的预期效果。 其他详细信息请看这里。 标签:rspec
python库。资源全名:expectations-1.0.1.tar.gz