brunoalvarelho / behat-contexts
Behat contexts
3.3.1
2022-02-11 16:22 UTC
Requires
- php: >=5.5
- behat/behat: ^3.0.13
- friends-of-behat/mink-extension: ^2.3.1
- justinrainbow/json-schema: ^5.0
- symfony/dom-crawler: ^2.4|^3.0|^4.0|^5.0
- symfony/http-foundation: ^2.3|^3.0|^4.0|^5.0
- symfony/property-access: ^2.3|^3.0|^4.0|^5.0
Requires (Dev)
- atoum/atoum: ^2.8|^3.0
- behat/mink-goutte-driver: ^1.1
- behat/mink-selenium2-driver: ^1.4@dev
- fabpot/goutte: ^3.2
- guzzlehttp/guzzle: ^6.3
Replaces
- sanpi/behatch-contexts: 3.3.1
README
Behatch contexts提供最常用的Behat测试。
安装
此扩展需要
- Behat 3+
- Mink
- Mink 扩展
项目依赖
- 安装Composer
- 使用Composer安装该软件包
$ composer require --dev behatch/contexts
- 通过在您的
behat.yml
中指定其类来激活扩展
# behat.yml default: # ... extensions: Behatch\Extension: ~
项目引导
- 使用Composer下载Behatch骨架
$ php composer.phar create-project behatch/skeleton
浏览器、json、表格和rest步骤需要mink配置,更多信息请参见Mink扩展。
使用
在behat.yml
中启用所需上下文
default: suites: default: contexts: - behatch:context:browser - behatch:context:debug - behatch:context:system - behatch:context:json - behatch:context:table - behatch:context:rest - behatch:context:xml
示例
本项目是自我测试的,您可以通过features目录找到一些示例。
配置
browser
- 更多与浏览器相关的步骤(如mink)timeout
- 默认超时
debug
- 调试辅助步骤screenshotDir
- 存储屏幕截图的目录
system
- 与shell相关的步骤root
- 文件系统的根目录
json
- 与JSON相关的步骤evaluationMode
- JavaScript "foo.bar" 或 PHP "foo->bar"
table
- 与HTML表格的交互rest
- 发送GET、POST等请求并测试HTTP头xml
- 与XML相关的步骤
配置示例
例如,如果您想将默认目录更改为屏幕截图,可以这样做
default: suites: default: contexts: - behatch:context:debug: screenshotDir: "var"