edno/codeception-gherkin-param
最新稳定版本:2.0.13
Composer 安装命令:
composer require edno/codeception-gherkin-param
包简介
Codeception module for supporting parameter notation in Gherkin features
README 文档
README
The Codeception module for supporting parameter notation in Gherkin scenario.
Minimum Requirements
- Codeception 3.x, 4.x, 5.x
- PHP 7.4 - 8.2 (use release 2.0.6 for older PHP versions)
Installation
The module can be installed using Composer
composer require edno/codeception-gherkin-param --dev
Be sure to enable the module in codeception.yml as shown in
configuration below.
Setup
Enabling Gherkin Param is done in codeception.yml.
modules: enabled: - Codeception\Extension\GherkinParam
Configuration
By default GherkinParam behavior is to keep the parameter string unchanged when the replacement value for a parameter cannot be found, i.e., the parameter does not exist or is not accessible.
onErrorThrowException
If true, then GherkinParam will throw an exception GherkinParam at runtime when a replacement value cannot be found for a parameter:
modules: enabled: - Codeception\Extension\GherkinParam: onErrorThrowException: true
If
onErrorThrowExceptionis set then it will overrideonErrorNullable.
onErrorNullable
If true, then GherkinParam will set to null parameters for which a replacement value cannot be found:
modules: enabled: - Codeception\Extension\GherkinParam: onErrorNullable: true
Usage
Once installed, you will be able to access variables stored using Fixtures.
Simple parameters
In scenario steps, the variables can be accessed using the syntax {{param}}.
While executing your features, the variables will be automatically replaced by their value.
Array parameters
You can refer to an element in an array using the syntax {{param[key]}}.
Test Suite Config parameters
You can refer to a test suite configuration parameter using the syntax {{config:param}}.
Note that the keyword config: is mandatory.
Example
Feature: Parametrize Gherkin Feature In order to create a dynamic Gherkin scenario As a tester I need to be able to share data between scenario steps Scenario: Scenario using simple parameter Given I have a parameter "test" with value "42" Then I should see "{{test}}" equals "42" Scenario: Scenario using array parameter Given I have an array "test" with values [1, two, 3.14, IV, 101] Then I should see "{{test[1]}}" equals "two" Scenario: Scenario using config parameter Given I have a configuration file "acceptance.suite.yml" containing """ theResponse: 42 """ When I execute a scenario calling the parameter 'theResponse' Then I should see "{{config:theResponse}}" equals "42"
The steps definition in AcceptanceTester.php do not require any change
/** * @Given I have a parameter :param with value :value */ public function iHaveAParameterWithValue($param, $value) { Fixtures::add($param, $value); } /** * @Then I should see :arg1 equals :arg2 */ public function iSeeEqual($arg1, $arg2) { $this->assertEquals($arg1, $arg2); }
You can find more examples in the test folder.
Contributions
Contributions, issues, and feature requests are very welcome. If you use this package and have fixed a bug for yourself, please consider submitting a PR!
Made with contributors-img.
edno/codeception-gherkin-param 适用场景与选型建议
edno/codeception-gherkin-param 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 130.79k 次下载、GitHub Stars 达 9, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「BDD」 「test」 「module」 「extension」 「codeception」 「gherkin」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 edno/codeception-gherkin-param 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 edno/codeception-gherkin-param 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 edno/codeception-gherkin-param 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Helper that decorates any SUS with a phpspec lazy object wrapper
Behat Context for testing Symfony Api
Provides access to magento2 object manager from behat and allows to change magento config settings temporarly
Testing Suite For Lumen like Laravel does.
Specification-oriented BDD helpers for PHPUnit
bootstrap select field module implementing http://silviomoreto.github.io/bootstrap-select/
统计信息
- 总下载量: 130.79k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 28
- 依赖项目数: 1
- 推荐数: 1
其他信息
- 授权协议: Apache-2.0
- 更新时间: 未知