php - Cucumber:如何在 PHP 中编写代码片段/步骤定义?

标签 php ruby cucumber

我正在尝试让 Cucumber 工作以测试 PHP 应用程序。到目前为止,我可以通过简单地在我的功能目录中运行 cucumber 来运行该功能。在结果的底部,它说:

If you want snippets in a different programming language, just make sure a file with the appropriate file extension exists where cucumber looks for step definitions.

这到底是什么意思?我可以在 Ruby 中编写大部分步骤定义,但在某些时候,我将需要创建一些设置数据(最好是在 PHP 中创建)。我如何按照该语句的建议在 PHP 中编写步骤定义?

仅供引用:我也是 Ruby 和 Cucumber 的新手。


解决方案:Cuke4PHP

Cuke4PHP 实现了 Cucumber wire 协议(protocol),使得用 PHP 编写步骤定义成为可能。

最佳答案

如果您没有找到解决方案,这就是我今天找到的!这家伙省去了我使用 PHP 时必须做的工作,哈哈

https://github.com/olbrich/cuke4php

他实现了 wire protocol对于 PHP。简而言之,这是另一台在 Cucumber 找到时运行 PHP 步骤的服务器。还传回结果。

啊,不用再配置 env.rb 了。

关于php - Cucumber:如何在 PHP 中编写代码片段/步骤定义?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3944970/

相关文章:

javascript - 用 Cucumber 以不显眼的方式测试 JavaScript?

java - cucumber arity 不匹配 : trying to bind several matching groups to a single stepdef parameter

php - 使用 Codeigniter 的 ActiveRecord 对 SELECT 查询中的列值求和

ruby-on-rails - 如何在 Ruby on Rails 中加入嵌套的 own_to

php - 当一些子区间结果已知时如何有效地迭代

ruby - 负索引如何与 `Array#[]=` 一起使用?

mysql - Rails安装mysql错误

javascript - 使用 ruby​​ 访问 Javascript 值

php - 读取 DOM PHP 的部分内容

php - 手动安装Apache/MySQL和PHP的优点