Cucumber: How to write fragment / step definitions in PHP?

I am trying to get Cucumber to work on testing a PHP application. For now, I can run this function by simply running cucumberin my function directory. The bottom of the results says:

If you need fragments in another programming language, just make sure that the file with the corresponding file extension exists, where the cucumber is looking for step definitions.

What does it mean? I am fine with writing most step definitions in Ruby, but at some point I will need to create some configuration data (ideally creating them in PHP). How can I write step definitions in PHP, as this statement suggests?

FYI: I am new to Ruby and Cucumber.


Solution: Cuke4PHP

Cuke4PHP implements Cucumber's wire protocol, allowing you to write step definitions in PHP.

+3
source share
3 answers

If you have not found a solution, this is what I found today! This guy saved me the work I had to do to use PHP lol

https://github.com/olbrich/cuke4php

He has implemented a wired protocol for PHP. This, in a nutshell, is another server that runs PHP steps when Cucumber finds any. Also returns results.

No more configuring env.rb.

+3
source

Take a look at Behat, the Cucumber version for PHP: http://everzet.com/Behat/

+3
source

features/step_definitions, , Cucumber, , , ", 3 ":

Given /^I have (\d+) cucumbers in my belly$/ do |cukes|
  # Some Ruby code here
end

http://github.com/aslakhellesoy/cucumber/wiki/Step-Definitions

PHP, features/step_definitions (features/support/env.rb) . Cucumber:

http://github.com/aslakhellesoy/cucumber/wiki/php

Google PHP Cucumber, Webrat Selenium, :

http://dev.af83.com/testing/acceptance-tests-php-project-cucumber-webrat-selenium-trio/2010/06/03

, , Cucumber, , , Clucumber (Common Lisp):

http://github.com/aslakhellesoy/cucumber/wiki/wire-protocol

PHP, , .

+2

Source: https://habr.com/ru/post/1769793/


All Articles