定制 kingdutch/cucumber-linter 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kingdutch/cucumber-linter

Composer 安装命令:

composer require --dev kingdutch/cucumber-linter

包简介

Cucumber Linter - Static analysis tool for Cucumber and Behat

README 文档

README

Cucumber Linter focuses on providing consistent formatting for Cucumber (.feature) files.

Getting Started

Cucumber Linter requires PHP >= 8.0 to function. The linter expects your files to have the .feature extension.

Installation

To start linting your Cucumber/Gherkin files, require Cucumebr Linter using Composer.

composer require --dev kingutch/cucumber-linter

Composer will install Cucumber Linter’s executable in its bin-dir which defaults to vendor/bin.

You can also download the latest PHAR and just use that.

Running the linter

To lint your test files, point the linter to the right file(s) or directory.

For example to lint your checkout and login Behat files:

vendor/bin/cucumber-linter tests/behat/features/capabilities/checkout tests/behat/features/capabilities/login

Rules enforced

In this initial release the linter does not provide a way to configure which rules are running or add rules, but has a hardcoded list of rules.

Current rules are aimed at writing focused and consistent tests that clearly test a single thing. Tests should go through the three stages of arrange, act, assert. In the arrange stage pre-required existing (tested elsewhere) functionality is scaffolded. In the act stage we're taking some user action that triggers business logic. In the assert state we verify that the result of the action with the business logic has the desired result.

Scenarios should be written in such a way that the different stages of a test are easily identifyable. Additionally each stage should only occur once. A repetition of a stage suggests the test may be unfocused and should be split into multiple scenarios. Keeping scenario's focused on testing a limited scope provides stakeholders with the most information when they fail and reduces the scope of work that requires debugging to find a cause.

Requires backgrounds to be non-empty

Empty backgrounds will not cause errors in test executors but they create visual noise for people reading the test and it provides unclarity over the test writer's intentions.

Requires the first step in a background to be Given

Backgrounds provide shared scaffolding so they should always be an extension of the arrange phase, hence Given.

Requires subsequent steps in a background to start with And

Backgrounds provide shared scaffolding so they should always be an extension of the arrange phase, so subsequent steps to the first one are part of the same stage denoted by And.

Requires indentation within backgrounds and scenario's to be constant

This ensures there's a consistent left indentation for the eye to jump back to when reading the test file as test.

Requires a blank line before When and Then blocks

This provides the visual separation between the different phases in a test allowing for easy scannability.

Requires the first step in a scenario to be Given

The first step in a test should be to arrange the system into a known working state, this is signaled by Given.

Requires Given, When, and Then to occur exactly once in a scenario in order

Repetition of words signalling a certain stage indicate that a scenario should probably be split up. Enforcing the Given, When, and Then order enforces the arrange, act, and assert order of the scenario.

Contributing

Any contributions are welcome. Cucumber Linter's source code open to pull requests lives at kingdutch/cucumber-linter-src.

kingdutch/cucumber-linter 适用场景与选型建议

kingdutch/cucumber-linter 是一款 基于 Standard ML 开发的 Composer 扩展包,目前已累计 88.65k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 11 月 25 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「Behat」 「static analysis」 「dev」 「Cucumber」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 kingdutch/cucumber-linter 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 kingdutch/cucumber-linter 我们能提供哪些服务?
定制开发 / 二次开发

基于 kingdutch/cucumber-linter 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 88.65k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 26
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: Standard ML

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-11-25