worldia/contexts

Behatch contexts

维护者

详细信息

github.com/worldia/contexts

源代码

安装: 677

依赖者: 0

建议者: 0

安全: 0

星星: 0

关注者: 0

分支: 203

语言: Gherkin

3.3.4 2022-08-02 08:35 UTC

README

Build status Scrutinizer Code Quality Code Coverage SensioLabsInsight

Behatch contexts提供最常用的Behat测试。

安装

此扩展需要

  • Behat 3+
  • Mink
  • Mink扩展

项目依赖

  1. 安装Composer
  2. 使用Composer安装该软件包
$ composer require --dev behatch/contexts
  1. 通过指定其类在您的behat.yml中激活扩展
# behat.yml
default:
    # ...
    extensions:
        Behatch\Extension: ~

项目启动

  1. 使用Composer下载Behatch骨架
$ php composer.phar create-project behatch/skeleton

浏览器、json、table和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

示例

此项目是自测试的,您可以探索功能目录以查找一些示例。

配置

  • 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"

翻译

See more information on Transifex.com