damien-list / contexts
Behatch contexts
3.2.0
2018-08-13 16:31 UTC
Requires
- php: >=5.5
- behat/behat: ^3.0.13
- behat/mink-extension: ^2.3.1
- justinrainbow/json-schema: ^5.0
- symfony/dom-crawler: ^2.4|^3.0|^4.0
- symfony/http-foundation: ^2.3|^3.0|^4.0
- symfony/property-access: ^2.3|^3.0|^4.0
Requires (Dev)
- atoum/atoum: ^2.8|^3.0
- behat/mink-goutte-driver: ^1.1
- behat/mink-selenium2-driver: ^1.3
- fabpot/goutte: ^3.2
- guzzlehttp/guzzle: ^6.3
Replaces
- sanpi/behatch-contexts: 3.2.0
This package is auto-updated.
Last update: 2024-09-26 02:16:03 UTC
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、table 和 rest 步骤需要 mink 配置,有关更多信息,请参阅 Mink 扩展
用法
在 behat.yml
中,启用所需的 contexts
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"