Behavior-Driven Development with Cucumber This Page Intentionally Left Blank Behavior-Driven Development with Cucumber

Behavior-Driven Development with Cucumber This Page Intentionally Left Blank Behavior-Driven Development with Cucumber

Behavior-Driven Development with Cucumber This page intentionally left blank Behavior-Driven Development with Cucumber Better Collaboration for Better Software Richard Lawrence with Paul Rayner Boston • Columbus • New York • San Francisco • Amsterdam • Cape Town • Dubai London • Madrid • Milan • Munich • Paris • Montreal • Toronto • Delhi • Mexico City São Paulo • Sydney • Hong Kong • Seoul • Singapore • Taipei • Tokyo Many of the designations used by manufacturers and sellers to distinguish their Publisher products are claimed as trademarks. Where those designations appear in this book, Mark L. Taub and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals. Acquisitions Editor Haze Humbert The authors and publisher 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 Development Editor or omissions. No liability is assumed for incidental or consequential damages in Ellie Bru connection with or arising out of the use of the information or programs contained herein. Managing Editor For information about buying this title in bulk quantities, or for special sales Sandra Schroeder opportunities (which may include electronic versions; custom cover designs; and content particular to your business, training goals, marketing focus, Senior Project Editor or branding interests), please contact our corporate sales department at Tonya Simpson [email protected] or (800) 382-3419. Indexer For government sales inquiries, please contact [email protected]. Erika Millen For questions about sales outside the U.S., please contact [email protected]. Proofreader Visit us on the Web: informit.com/aw Abigail Manheim Library of Congress Control Number: 2019937018 Technical Reviewers Leslie Brooks Copyright © 2019 Pearson Education, Inc. Matt Heuser All rights reserved. This publication is protected by copyright, and permission must Nicole Forsythe be obtained from the publisher prior to any prohibited reproduction, storage in a Matt Wynne retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permissions, request Cover Designer forms and the appropriate contacts within the Pearson Education Global Rights & Chuti Prasertsith Permissions Department, please visit www.pearsoned.com/permissions/. Compositor codeMantra ISBN-13: 978-0-321-77263-3 ISBN-10: 0-321-77263-6 1 19 Cover photograph © Food Travel Stockforlife/Shutterstock Contents Acknowledgments . ix About the Authors . xi Chapter 1: Focusing on Value . 1 When Scrum Isn’t Enough . 3 Finding a High-Value Feature to Start With . 5 Before You Start with Cucumber . 7 Finding the First MMF . 8 Slicing an MMF into User Stories . 10 Summary . 14 Reference . 14 Chapter 2: Exploring with Examples . 15 BDD Is a Cooperative Game . 19 BDD Is a Whole Team Thing . 20 Allow Time and Space to Learn . 21 Flesh Out the Happy Path First . 27 Use Real Examples . 27 Example Mapping Gives the Discussion Structure . 28 Optimizing for Discovery . 32 Addressing Some Concerns . 33 Treat Resistance as a Resource . 39 Playing the BDD Game . 41 Opening . 42 Exploring . 42 Closing . 44 Summary . 45 References . 46 v vi Contents Chapter 3: Formalizing Examples into Scenarios . 47 Moving from Examples to Scenarios . 47 Feature Files as Collaboration Points . 51 BDD Is Iterative, Not Linear . 65 Finding the Meaningful Variations . 66 Gherkin: A Language for Expressive Scenarios . 66 Summary . 72 Resources . 72 Chapter 4: Automating Examples . 73 The Test Automation Stack . 76 Adjusting to Working Test-First . 82 Annotating Element Names in Mockups . 84 How Does User Experience Design Fit In to This? . 85 Did They Really Just Hard Code Those Results? . 89 Anatomy of a Step Definition . 90 Simple Cucumber Expressions . 91 Regular Expressions . 92 Anchors . 92 Wildcards and Quantifiers . 93 Capturing and Not Capturing . 93 Just Enough . 94 Custom Cucumber Expressions Parameter Types . 94 Beyond Ruby . 96 Slow Is Normal (at First) . 101 Choose Cucumber Based on Audience, Not Scope . 103 Summary . 104 Chapter 5: Frequent Delivery and Visibility . 105 How BDD Changes the Tester’s Role . 105 Exploratory Testing . 114 BDD and Automated Builds . 116 Faster Stakeholder Feedback . 119 How Getting to Done More Often Changes All Sorts of Things . 123 Frequent Visibility and Legacy Systems . 125 Documentation: Integrated and Living . 127 Contents vii Avoiding Mini-Waterfalls and Making the Change Stick . 131 Summary . 135 References . 135 Chapter 6: Making Scenarios More Expressive . 137 Feedback About Scenarios . 137 How to Make Your Scenarios More Expressive . 143 Finding the Right Level of Abstraction . 144 Including the Appropriate Details . 146 Expressive Language in the Steps . 147 Refactoring Scenarios . 150 Good Scenario Titles . 151 Summary . 151 References . 152 Chapter 7: Growing Living Documentation . 153 What Is Living Documentation and Why Is It Better? . 153 Cucumber Features and Other Documentation . 154 Avoid Gherkin in User Story Descriptions . 155 The Unexpected Relationship Between Cucumber Features and User Stories . 157 Stable Scenarios . 159 Growing and Splitting Features . 160 Split When Backgrounds Diverge . 160 Split When a New Domain Concept Emerges . 161 Secondary Organization Using Tags . 161 Structure Is Emergent . 163 Summary . 163 Chapter 8: Succeeding with Scenario Data . 165 Characteristics of Good Scenarios . 168 Independent . 168 Repeatable . 168 Researchable . ..

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    53 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us