remialvado/上下文

Behatch 上下文

维护者

详细信息

github.com/remialvado/contexts

源代码

安装: 28

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 203

语言: Gherkin

3.4.0 2022-09-02 06:06 UTC

This package is auto-updated.

Last update: 2024-08-30 01:55:17 UTC


README

Build status Scrutinizer Code Quality Code Coverage SensioLabsInsight

Behatch 上下文提供最常见的 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、表格和 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"

翻译

See more information on Transifex.com