The Secret Ninja Cucumber Scrolls

The Secret Ninja Cucumber Scrolls

Strictly Confidential

David de Florinier

Gojko Adzic

Annette de Florinier

Cover design 

Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where these designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals.

The authors have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein.

This is a free document. You may use it and redistribute it freely unmodified and in its original form. All other rights are reserved by the authors. This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permissions, write to:

Neuri Limited
25 Southampton Buildings
London WC2A 1AL
United Kingdom

2011 03 16


About this document
What's new in this version
Online
Become a contribuninja
About the authors
Ninja training
1. Why should you care about Cucumber?
Why use Cucumber?
How does Cucumber compare to other tools?
What does Cucumber have to do with BDD
Second Generation
Outside-in and pull-based
Multiple-stakeholder
Multiple-scale
Agile
High-automation
I. Getting Started
2. Cucumber and Ruby
Installing Cucumber
Hello World from Ruby
3. Cucumber and .NET
Setting up Ruby
Checking if Ruby is installed correctly
Installing Cucumber and Cuke4Nuke
Verifying that Cuke4Nuke is installed correctly
Hello World from .NET
Build integration
Continuous Integration
Debugging Cuke4Nuke steps
4. Cucumber and Java
Using JRuby directly
Checking whether JRuby is installed correctly
Installing the Cuke4Duke gem
Running Cuke4Duke from JRuby
Debugging from a Java IDE
Using ANT and Ivy
Project build file
Project dependencies
Ivy settings
Running Cucumber through ANT
Using Maven
Setting up the POM file
Running Cuke4Duke from Maven
Hello world from Java
Project Setup
Adding the feature file
Writing step definitions
Continuous integration
Setting up CI using TeamCity
II. Gherkin
5. Cucumber feature files
Cucumber jargon
Stakeholder
Feature
User story
Feature file
Key Examples
Scenario
Step
Step Definition
Gherkin
How Cucumber interprets feature files
What makes a good feature file
Feature files should be written collaboratively
Structuring scenarios
Given
When
Then
The difference between When and Then
Internationalisation
Tagging for fun and profit
Remember
6. Implementing the steps
The basic feature file — again
Steps and regular expressions
Initialising the context
Triggering the action
Validating the result
Implementing in Ruby
Initializing the context
Triggering the action
Validating the result
Implementing the domain code
Implementing in Java
Initializing the context
Triggering the action
Validating the result
Implementing the domain code
Implementing in .NET
Initializing the context
Triggering the action
Validating the result
Implementing the domain code
Sharing context across step definition files
Sharing context in Ruby
Sharing context in Java
Sharing context in .NET
7. Managing complex scenarios
Complex setups and validations
Managing groups of related scenarios
Working with sets of attributes
Reading tables in Ruby
Reading tables in Java
Reading tables in .NET
Working with lists of objects
Advanced table operations in Ruby
Advanced table operations in Java
Advanced table operations in .NET
Using backgrounds to group related pre-conditions
Using hooks to manage cross-cutting concerns
Scenario hooks in Ruby
Scenario hooks in Java
Scenario hooks in .NET
III. Web automation
8. The Three Layers of UI Automation
Easy to understand
Efficient to write
Relatively inexpensive to maintain
The benefits of three levels
9. Getting Ruby ready to exercise the UI
Rails
Rails 2
Rails 3
Sinatra
Gordon is alive?!
Feeding Sinatra with cucumbers
Raking your cucumber patch
10. .Net and WatiN
Getting Ready
WatiN
Creating a Project
Making sure WatiN is working
CodeTrack
Putting it to the test
Creating the Feature file
Step Definitions
User Workflow
Project Workflow
Issue and Table
The Technical Layer
The When and Then Step Definitons
A. Resources
Books
Tools
Articles
Videos