<DIV><p> Behaviour Driven Development is about writing software that matters. It is an approach to agile software development that takes cues from Test Driven Development, Domain Driven Design, and Acceptance Test Driven Planning. RSpec and Cucumber are the leading Behaviour Driven Development to
The RSpec Book: Behaviour Driven Development with Rspec, Cucumber, and Friends (The Facets of Ruby Series)
β Scribed by David Chelimsky, Dave Astels, Bryan Helmkamp, Dan North, Zach Dennis, Aslak Hellesoy
- Publisher
- Pragmatic Bookshelf
- Year
- 2010
- Tongue
- English
- Leaves
- 426
- Edition
- 1
- Category
- Library
No coin nor oath required. For personal study only.
β¦ Synopsis
You'll get started right away with RSpec 2 and Cucumber by developing a simple game, using Cucumber to express high-level requirements in language your customer understands, and RSpec to express more granular requirements that focus on the behavior of individual objects in the system. You'll learn how to use test doubles (mocks and stubs) to control the environment and focus the RSpec examples on one object at a time, and how to customize RSpec to "speak" in the language of your domain. You'll develop Rails 3 applications and use companion tools such as Webrat and Selenium to express requirements for web applications both in memory and in the browser. And you'll learn to specify Rails views, controllers, and models, each in complete isolation from the other. Whether you're developing applications, frameworks, or the libraries that power them, The RSpec Book will help you write better code, better tests, and deliver better software to happier users.
β¦ Table of Contents
Contents......Page 5
Foreword......Page 11
About the Authors......Page 14
Acknowledgments......Page 16
Ruby and Gem Versions......Page 18
What's in This Book......Page 19
Getting Started with RSpec and Cucumber......Page 21
Test-Driven Development: Where It All Started......Page 22
Behaviour-Driven Development: The Next Step......Page 24
RSpec......Page 25
Cucumber......Page 26
The BDD Cycle......Page 28
Installation......Page 30
Hello RSpec......Page 31
Hello Cucumber......Page 33
Describing Features......Page 37
Planning the First Release......Page 38
Planning the First Iteration......Page 44
What We've Learned......Page 52
Automating Features with Cucumber......Page 53
Steps and Step Definitions......Page 55
Step Definition Methods......Page 56
Test Double......Page 60
What We've Learned......Page 62
Getting Started with RSpec......Page 63
Red: Start with a Failing Code Example......Page 66
Green: Get the Example to Pass......Page 68
Refactor......Page 72
What We've Learned......Page 76
Scenario Outlines in Cucumber......Page 77
Responding to Change......Page 80
What We've Learned......Page 83
Begin with the Simplest Example......Page 84
Refactor to Remove Duplication......Page 88
Refactor to Express Intent......Page 89
What We've Learned......Page 94
Sniffing Out Code Smells......Page 96
One Step at a Time......Page 98
Updating Specs After Refactoring......Page 107
Exploratory Testing......Page 111
What We've Learned......Page 112
Use Cucumber for Collaboration......Page 114
Experimenting with a New Implementation......Page 118
What We've Learned......Page 122
Behaviour-Driven Development......Page 124
How Traditional Projects Fail......Page 125
Why Traditional Projects Fail......Page 126
Redefining the Problem......Page 130
The Cost of Going Agile......Page 133
What We've Learned......Page 136
The Principles of BDD......Page 138
The Project Inception......Page 139
The Cycle of Delivery......Page 141
What's in a Story?......Page 145
What We've Learned......Page 148
RSpec......Page 149
Code Examples......Page 150
Describe It!......Page 151
Pending Examples......Page 155
Hooks: Before, After, and Around......Page 158
Helper Methods......Page 162
Shared Examples......Page 164
Nested Example Groups......Page 166
What We've Learned......Page 169
RSpec::Expectations......Page 170
should, should_not, and matchers......Page 171
Built-in Matchers......Page 172
Predicate Matchers......Page 180
Be True in the Eyes of Ruby......Page 181
Have Whatever You Like......Page 182
Operator Expressions......Page 186
Generated Descriptions......Page 187
Subjectivity......Page 188
What We've Learned......Page 190
RSpec::Mocks......Page 191
Test Doubles......Page 192
Method Stubs......Page 193
Message Expectations......Page 195
Test-Specific Extensions......Page 197
More on Method Stubs......Page 201
More on Message Expectations......Page 203
When to Use Test Doubles and Test-Specific Extensions......Page 213
Risks and Trade-Offs......Page 218
Choosing Other Test Double Frameworks......Page 220
What We've Learned......Page 222
The rspec Command......Page 224
TextMate......Page 229
Rake......Page 230
RCov......Page 232
What We've Learned......Page 233
Metadata......Page 234
Filtering......Page 235
Extension Modules......Page 238
Mock Framework......Page 239
Custom Matchers......Page 240
Macros......Page 244
Custom Formatters......Page 247
What We've Learned......Page 250
Cucumber......Page 251
Intro to Cucumber......Page 252
Features......Page 253
Gherkin......Page 257
Scenarios......Page 259
Steps......Page 260
The cucumber Command......Page 261
Given/When/Then......Page 262
Declarative and Imperative Scenario Styles......Page 263
Organizing Features......Page 264
Tags......Page 265
What We've Learned......Page 267
Step Definitions......Page 269
World......Page 271
Calling Steps Within Step Definitions......Page 272
Hooks......Page 273
Background......Page 275
Multiline Text......Page 276
Tables in Steps......Page 277
Scenario Outlines......Page 278
What We've Learned......Page 280
Behaviour-Driven Rails......Page 282
BDD in Rails......Page 283
Outside-In Rails Development......Page 284
Setting Up a Rails 3 Project......Page 286
What We've Learned......Page 289
Step Definition Styles......Page 290
Direct Model Access......Page 292
What We've Learned......Page 297
Simulating the Browser with Webrat......Page 298
Writing Simulated Browser Step Definitions......Page 299
Navigating to Pages......Page 304
Manipulating Forms......Page 308
Specifying Outcomes with View Matchers......Page 313
Building on the Basics......Page 316
What We've Learned......Page 319
Automating the Browser with Webrat and Selenium......Page 320
Getting Started......Page 321
Writing Step Definitions for Selenium......Page 324
Debugging Selenium Issues......Page 328
What We've Learned......Page 330
Writing View Specs......Page 331
Mocking Models......Page 334
Specifying Helpers......Page 341
What We've Learned......Page 343
Controller Specs......Page 345
Context-Specific Examples......Page 352
Specifying ApplicationController......Page 361
What We've Learned......Page 363
Writing Model Specs......Page 365
Specifying Business Rules......Page 373
Exercise......Page 382
Useful Tidbits......Page 383
What We've Learned......Page 386
RubySpec......Page 388
Syntax......Page 389
Guards......Page 391
Extensibility......Page 392
Tags......Page 394
Community......Page 395
RSpec's Built-in Expectations......Page 397
Bibliography......Page 401
A......Page 403
B......Page 404
C......Page 405
D......Page 407
E......Page 408
F......Page 409
H......Page 411
M......Page 412
O......Page 414
P......Page 415
R......Page 416
S......Page 418
T......Page 420
U......Page 421
Z......Page 422
β¦ Subjects
ΠΠΈΠ±Π»ΠΈΠΎΡΠ΅ΠΊΠ°;ΠΠΎΠΌΠΏΡΡΡΠ΅ΡΠ½Π°Ρ Π»ΠΈΡΠ΅ΡΠ°ΡΡΡΠ°;Ruby / RoR;
π SIMILAR VOLUMES
Behaviour-Driven Development (BDD) gives you the best of Test Driven Development, Domain Driven Design, and Acceptance Test Driven Planning techniques, so you can create better software with self-documenting, executable tests that bring users and developers together with a common language. Get the
<p><span>Learn to properly test Ruby and Ruby on Rails applications by first writing failing tests, and then by implementing application code to make the failing tests pass. This book will teach you how to employ test-driven development (TDD) using RSpec while building a blog from start to finish. B
<DIV><p>Your customers want rock-solid, bug-free software that does exactly what they expect it to do. Yet they can't always articulate their ideas clearly enough for you to turn them into code. <I>The Cucumber Book</I> dives straight into the core of the problem: communication between people. Cucum
Matt Wynne and Aslak Hellesoy show you how to express your customers wild ideas as a set of clear, executable specifications that everyone on the team can read. You'll learn how to feed those examples into Cucumber and let it guide your development. You'll build just the right code to keep your cust