Appendix 1
Using Cucumber with Other Platforms

Although Cucumber started as a Ruby tool, it has grown to embrace many other platforms. This means you’re able to write your Cucumber step definitions in the same language you use for your production code and reach directly into your domain model if necessary. Explaining in detail how to use Cucumber to drive all of those platforms is beyond the scope of this book, but this appendix should give you some pointers where to look for more information.

Platform

Tool

Further Information

iOS / macOs

Cucumberish

https://github.com/Ahmed-Ali/Cucumberish

PHP

Behat

https://github.com/Behat/Behat

JavaScript/Node.js

cucumber-js

https://github.com/cucumber/cucumber-js

Java and other JVM languages

cucumber-jvm

https://github.com/cucumber/cucumber-jvm

Microsoft .NET/Mono

SpecFlow

http://specflow.org/

C++

cucumber-cpp

https://github.com/cucumber/cucumber-cpp

Python

Behave

https://github.com/behave/behave

If you’re interested in understanding how these tools work or writing your own, you could look into two main things: the Gherkin parser and the wire protocol.

Gherkin is the language you use to write Cucumber specifications, and it’s also a library[72] you can use to parse them. It uses Berp[73] to generate its code. At the time of writing, the Gherkin parser is released for the following platforms:

  • Ruby

  • Java

  • JavaScript

  • .NET

  • Go

  • Python

  • Objective-C

  • Perl

This allows you to build your own version of Cucumber on top of any of those platforms, and that’s how Cucumber-JVM, Cucumber-JS, and SpecFlow all work.

The second piece of the puzzle is Cucumber’s wire protocol. This allows Cucumber to invoke step definitions running in another process through a TCP socket. That process could be running on any machine and be written in any language. As we write this, Cucumber-CPP is the main user of the wire protocol, allowing developers to write step definitions in C++, and invoke them from Cucumber itself. Cucumber’s wire protocol is well documented, with examples, in Cucumber’s own features. See the Cucumber Wire Protocol source code [74] for details.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.14.98