twentytwo-labs/behat-open-api
Composer 安装命令:
composer require twentytwo-labs/behat-open-api
包简介
Behat contexts
README 文档
README
Behat Open Api contexts provide most common Api Behat tests.
Installation
This extension requires:
- Behat 3+
- Mink extension
Project dependency
- Install Composer
- Require the package with Composer:
$ composer require --dev twentytwo-labs/behat-open-api
- Activate extension by specifying its class in your
behat.yml:
# behat.yml default: # ... extensions: TwentytwoLabs\BehatOpenApiExtension: schemaFile: "file:///path/to/your/schema" #optinal
Usage
In behat.yml, enable desired contexts:
default: suites: default: contexts: - TwentytwoLabs\BehatOpenApiExtension\Context\DebugContext: ~ - TwentytwoLabs\BehatOpenApiExtension\Context\RestContext: ~ - TwentytwoLabs\BehatOpenApiExtension\Context\JsonContext: ~ - TwentytwoLabs\BehatOpenApiExtension\Context\OpenApiContext: ~
Examples
-
TwentytwoLabs\BehatOpenApiExtension\Context\DebugContext@Then print last response headers@Then print profiler link
-
TwentytwoLabs\BehatOpenApiExtension\Context\JsonContext@Then the response should be in JSON@Then the response should not be in JSON@Then the JSON node :node should be equal to :text@Then the JSON nodes should be equal to:@Then the JSON node :node should match :pattern@Then the JSON node :node should be null@Then the JSON node :node should not be null@Then the JSON node :node should be true@Then the JSON node :node should be false@Then the JSON node :node should be equal to the string :text@Then the JSON node :node should be equal to the number :number@Then the JSON node :node should have :count element(s)@Then the JSON node :node should contain :text@Then the JSON node :node should not contain :text-
@Then the JSON nodes should contain: | ... | -
@Then the JSON nodes should not contain: | ... | @Then the JSON node :name should exist@Then the JSON node :name should not exist@Then the JSON should be equal to:-
@Then I should see JSON with key : | ... | -
This step link to [Array-comparator](https://github.com/TwentytwoLabs/array-comparator package)@Then the JSON should be match to: | ... |
-
TwentytwoLabs\BehatOpenApiExtension\Context\OpenApiContext@Then the response should be valid according to the operation id :operationId
-
TwentytwoLabs\BehatOpenApiExtension\Context\RestContext@Then I add :name header equal to :value@Given I send a :method request to :path-
@Given I send a :method request to :path with parameters: | key | value | | ... | ..... | -
@Given I send a :method request to :path with body: """ { #... } """ @Then /^the response status code should be equal to (?P<code>\d+)$/-
@Then the response should be equal to: """ { # ... } """ @Then the response should be empty@Then the header :name should be equal to :value@Then the header :name should not be equal to :value@Then the header :name should contain :value@Then the header :name should not contain :value@Then the header :name should not exist@Then the header :name should match :regex@Then the header :name should not match :regex@Then the response should expire in the future@Then the response should be encoded in :encoding
twentytwo-labs/behat-open-api 适用场景与选型建议
twentytwo-labs/behat-open-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 49.52k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2022 年 06 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「symfony」 「Behat」 「swagger」 「openapi」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 twentytwo-labs/behat-open-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 twentytwo-labs/behat-open-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 twentytwo-labs/behat-open-api 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Behat Context for testing Symfony Api
A Behat Extension that allows custom bootstrapping
Environment processor and contexts autoloader
Provides access to magento2 object manager from behat and allows to change magento config settings temporarly
The bundle for easy using json-rpc api on your project
log the behat execution into json result
统计信息
- 总下载量: 49.52k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2022-06-10