gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-11-01 00:17:27 25 4
gpt4 key购买 nike

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

If you want snippets in a different programming language, just make sure a filewith 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com