Implement Apple Pay on Web

This is an almost complete guide to how you can implement Apple Pay on a website. I am writing this to bring everything I found to one place while I was doing the implementation. This article may be…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




How Cucumber Works

The Cucumber Book, Second Edition — by Matt Wynne, Aslak Hellesøy, with Steve Tooke (16 / 136)

👈 Living Documentation | TOC | What We Just Learned 👉

Before we dive into the meat of the book, let’s give you some context with a high-level overview of a typical Cucumber test suite. Cucumber is a command-line tool. When you run it, it reads in your specifications from plain-language text files called features, examines them for scenarios to test, and runs the scenarios against your system. Each scenario is a list of steps for Cucumber to work through. So that Cucumber can understand these feature files, they must follow some basic syntax rules. The name for this set of rules is Gherkin.

Along with the features, you give Cucumber a set of step definitions, which map the business-readable language of each step into Ruby code to carry out whatever action is being described by the step. In a mature test suite, the step definition itself will probably just be one or two lines of Ruby that delegate to a library of support code, specific to the domain of your application, that knows how to carry out common tasks on the system. Normally that will involve using an automation library, like the browser automation library Capybara, to interact with the system itself.

This hierarchy, from features down to automation library, is illustrated by the figure.

images/the-stack.png

If the Ruby code in the step definition executes without error, Cucumber proceeds to the next step in the scenario. If it gets to the end of the scenario without any of the steps raising an error, it marks the scenario as having passed. If any of the steps in the scenario fail, however, Cucumber marks the scenario as having failed and moves on to the next one. As the scenarios run, Cucumber prints out the results showing you exactly what is working and what isn’t.

That’s it in a nutshell. There are many other advantages to Cucumber that make it an excellent choice: you can write your specifications in more than forty different spoken languages, you can use tags to organize and group your scenarios, and you can easily integrate with a host of high-quality Ruby automation libraries to drive almost any kind of application. All that and more will become clear as you read the rest of the book.

👈 Living Documentation | TOC | What We Just Learned 👉

Add a comment

Related posts:

Exercises from Chapter 13

Printed in full color.For this new edition of the best-selling Learn to Program, Chris Pine has taken a good thing and made it even better. First, he used the feedback from hundreds of reader e-mails to update the content and make it even clearer. Second, he updated the examples in the book to use the latest stable version of R

Are You Out Of Writing Ideas? You Can Use 5 Of Mine

Without proper writing and creativity habits, you will never benefit from a neverending pool of writing ideas. But this is okay, it takes time to build your writer systems. Provide actionable advice…

Sustainable Tourism In The Anthropocene

The environmental writer Amitav Ghosh suggests that people of the future will regard us human beings of the present moment with astonishment. “There once was a strange time,” future parents will tell…