The Cucumber for Java Book
Behaviour-Driven Development for Testers and Developers
by: Seb Rose, Matt Wynne & Aslak Hellesøy
Published | 2015-02-15 |
---|---|
Internal code | srjcuc |
Print status | In Print |
Pages | 338 |
User level | Beginner |
Keywords | cucumber, java, jvm, testing, qa, quality assurance, sbe, bdd, testing |
Related titles | The Cucumber Book |
ISBN | 9781941222294 |
Other ISBN |
Channel epub: 9781680504989 Channel PDF: 9781680504996 Kindle: 9781680500660 Safari: 9781680500677 Kindle: 9781680500660 |
BISACs | COM051280 COMPUTERS / Programming Languages / JavaCOM051330 COMPUTERS / Software Development & Engineering / Quality Assurance & TestingCOM051330 COMPUTERS / Software Development & Engineering / Quality Assurance & Testing |
Highlight
Teams working on the JVM can now say goodbye forever to misunderstood requirements, tedious manual acceptance tests, and out-of-date documentation. Cucumber—the popular, open-source tool that helps teams communicate more effectively with their customers—now has a Java version, and our bestselling Cucumber Book has been updated to match. The Cucumber for Java Book has the same great advice about how to deliver rock-solid applications collaboratively, but with all code completely rewritten in Java. New chapters cover features unique to the Java version of Cucumber, and reflect insights from the Cucumber team since the original book was published.
Description
Until now it’s been difficult for teams developing Java applications to learn how to benefit from Behaviour-Driven Development (BDD). This book changes all that by describing in detail how to use Cucumber to harness the power of plain language specifications in your development process.
In part 1, you’ll discover how to use Cucumber’s Gherkin DSL to describe the behavior your customers want from the system. You’ll also learn how to write Java code that interprets those plain language specifications and checks them against your application. Part 2 guides you through a worked example, using Spring, MySQL, and Jetty. Enhanced chapters teach you how to use Selenium to drive your application and handle asynchronous Ajax calls, and new chapters cover Dependency Injection (DI) and advanced techniques to help keep your test suites fast. Part 3 shows you how to integrate Cucumber with your Continuous Integration (CI) system, work with a REST web service, and even use BDD with legacy applications.
Written by the creator of Cucumber and two of its most experienced users and contributors, The Cucumber for Java Book is an authoritative guide that will give you and your team all the knowledge you need to start using Cucumber with confidence.
!>https://a.pragprog.com/cms/pip/Cucumber%20Logo__7opd0z__.png"!
The Cucumber for Java Book – Q&A
What is Cucumber?
Cucumber lets software development teams describe how software should behave in plain text. The text is written in a business-readable domain-specific language and serves as documentation, automated tests, and collaborative development-aid—all rolled into one format.
Who is this book for?
The first part of this book is for the whole team—customer, product owner, business analyst, developer, tester, architect, Scrum master, and anyone else you can think of. The rest of the book focuses on more technical aspects of Cucumber for Java and is suitable mainly for developers and testers.
How will this book help us at work?
Seb, Matt, and Aslak have spent years consulting in a wide variety of organizations. In response, we developed Cucumber to help support the effective ways of working that we had learned. In this book you get the distillation of all that knowledge, along with in-depth advice that will help you be successful at Behaviour-Driven Development (BDD) using Cucumber.
Can’t I learn all this from the online documentation?
The online documentation gives you the bare bones of how Cucumber for Java works. This book has much more. From the invaluable BDD advice in part 1, through the extensive worked example in part 2, to the detailed technical insights in part 3, this book collects everything you need to know in one handy package.
Is the book useful even if my project isn’t written in Java?
Cucumber doesn’t care what language your project is written in. As long as there’s a way to interface with your project from Java, then Cucumber for Java can work for you. If your project is written in Java (or another JVM language), then your Cucumber scenarios can interact directly with the code, which can be very useful. The book also gives a brief introduction to writing your “glue” code in other JVM languages, such as Scala, Groovy, or Clojure.
Is this the same as The Cucumber Book?
The Cucumber for Java Book is based upon the best-selling original, The Cucumber Book. All the examples have been completely rewritten to take advantage of the Java version of Cucumber. There are new chapters that cover Java specific topics, such as Cucumber’s integration with various dependency injection containers, and there’s a brand new chapter on how to keep your Cucumber scenarios running fast as your project grows.
Is Cucumber just another test automation tool?
No it isn’t. Cucumber is a collaboration and documentation tool first. Start by getting your business people to collaborate effectively with your technical teams. Then use Cucumber to document those interactions as described in the book. Finally, automate those interactions using Cucumber to get the full value from your improved development process. Teams that try to use Cucumber only as a test automation tool generally find that it is the wrong tool—because that’s not what it was designed for.
Contents and Extracts
- Cucumber-JVM Fundamentals
- Why Cucumber-JVM?
- Automated Acceptance Tests
- Behaviour-Driven Development
- Living Documentation
- How Cucumber-JVM Works
- What We Just Learned
- First Taste
- Understanding Our Goal
- Creating a Feature
- Creating Step Definitions
- Implementing Our First Step Definition
- Changing Formatters
- Testing Our Checkout Class
- Adding an Assertion
- Making It Pass
- What We Just Learned
- Gherkin Basics
- What’s Gherkin For?
- Format and Syntax
- Feature
- Scenario
- Comments
- Spoken Languages
- What We Just Learned
- Step Definitions: From the Outside
- Steps and Step Definitions
- Capturing Arguments
- Multiple Captures
- Flexibility
- Returning Results
- What We Just Learned
- Expressive Scenarios
- Background
- Data Tables
- Scenario Outline
- Too Much Information
- Doc Strings
- Staying Organized with Tags and Subfolders
- What We Just Learned
- When Cucumbers Go Bad
- Feeling the Pain
- Working Together
- Caring for Your Tests
- Stop the Line and Defect Prevention
- What We Just Learned
- Why Cucumber-JVM?
- A Worked Example
- Step Definitions: On the Inside
- Sketching Out the Domain Model excerpt
- Staying Honest with Transforms
- Adding Custom Helper Methods
- Organizing the Code
- Dependency Injection
- What We Just Learned
- Support Code
- Fixing the Bug
- Bootstrapping the User Interface
- Making the Switch
- Using Hooks
- Getting to green
- What We Just Learned
- Dealing with Message Queues and Asynchronous Components
- Our New Asynchronous Architecture
- How to Synchronize
- Implementing the New Architecture
- Fixing the Flickering Scenario
- What We Just Learned
- Databases
- Iterative Database Development
- Refactoring to Use a Database
- Reading and Writing to the Database
- Cleaning the Database with Transactions
- Cleaning the Database with Truncation
- What We Just Learned
- Simplifying Our Design Using Dependency Injection excerpt
- DI and Cucumber-JVM
- Improving Our Design Using DI
- PicoContainer is Almost Invisible
- Moving to Guice
- Spring in Your Steps
- CDI with Weld
- What We Just Learned
- Working With Web Applications
- Selenium WebDriver
- Handling Failure excerpt
- Reusing the Browser
- AJAX
- What We Just Learned
- Keeping Your Features Fast
- Step Definitions: On the Inside
- More Techniques
- Controlling Cucumber-JVM
- Working with a REST web service
- Working with Legacy Applications