Learning Behavior driven Development with JavaScript Create powerful yet simple to code BDD test suites in JavaScript using the most popular tools in the community 1st Edition Enrique Amodeo all chapter instant download
Learning Behavior driven Development with JavaScript Create powerful yet simple to code BDD test suites in JavaScript using the most popular tools in the community 1st Edition Enrique Amodeo all chapter instant download
com
OR CLICK HERE
DOWLOAD NOW
https://ebookmeta.com/product/learning-tensorflow-js-powerful-machine-
learning-in-javascript-1st-edition-gant-laborde/
ebookmeta.com
https://ebookmeta.com/product/learning-tensorflow-js-powerful-machine-
learning-in-javascript-1st-edition-gant-laborde-2/
ebookmeta.com
https://ebookmeta.com/product/worship-taboo-mommy-domme-nina-sestina/
ebookmeta.com
Copyright And Fundamental Rights In The Digital Age: A
Comparative Analysis In Search Of A Common Constitutional
Ground 1st Edition Oreste Pollicino
https://ebookmeta.com/product/copyright-and-fundamental-rights-in-the-
digital-age-a-comparative-analysis-in-search-of-a-common-
constitutional-ground-1st-edition-oreste-pollicino/
ebookmeta.com
https://ebookmeta.com/product/a-companion-to-latin-american-
literature-and-culture-second-edition-sara-castro-klaren/
ebookmeta.com
https://ebookmeta.com/product/the-history-of-u-s-immigration-data-
cathy-dalessandro/
ebookmeta.com
https://ebookmeta.com/product/alzheimer-disease-sourcebook-health-
reference-7th-edition-angela-williams/
ebookmeta.com
https://ebookmeta.com/product/enjoyment-of-music-essential-listening-
fourth-edition-forney/
ebookmeta.com
www.it-ebooks.info
Learning Behavior-driven
Development with JavaScript
Enrique Amodeo
BIRMINGHAM - MUMBAI
www.it-ebooks.info
Learning Behavior-driven Development with JavaScript
All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy
of the information presented. However, the information contained in this book is
sold without warranty, either express or implied. Neither the author, nor Packt
Publishing, and its dealers and distributors will be held liable for any damages
caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
ISBN 978-1-78439-264-2
www.packtpub.com
www.it-ebooks.info
Credits
Reviewers Proofreaders
Domenico Luciani Stephen Copestake
Mihir Mone Maria Gould
Takeharu Oshida Paul Hindle
Juri Strumpflohner
Indexer
Commissioning Editor Priya Sane
Pramila Balan
Graphics
Acquisition Editor Sheetal Aute
Richard Brookes-Bland
Production Coordinator
Content Development Editors Nitesh Thakur
Sriram Neelakantan
Sharvari Tawde Cover Work
Nitesh Thakur
Technical Editor
Indrajit A. Das
Copy Editors
Karuna Narayanan
Laxmi Subramanian
www.it-ebooks.info
About the Author
As an agile practitioner, he uses BDD and emergent design in his everyday work
and tries to travel light. Experienced in both frontend and server-side development,
he has worked with several technical stacks, including Java/JEE, but since 2005, he
prefers to focus on JS and HTML5. He is now very happy to be able to apply his JS
knowledge to the server-side development, thanks to projects such as Node.js.
He also has written a book in Spanish on designing web APIs, following the REST
and hypermedia approach (https://leanpub.com/introduccion_apis_rest).
www.it-ebooks.info
About the Reviewers
Having fallen in love with his job, he lives in Italy; currently, he is working for
many companies in his country as a software/web developer. You can find more
information on him at http://dlion.it/.
After spending some time fiddling around with routers and switches, he
quickly decided to build upon his passion for web development—not design,
but development. Building web systems and applications rather than websites
with all their fancy Flash animations was something that was very interesting
and alluring to him. He even returned to his alma mater to teach web development
in order to give back what he had learned.
He is also a big JavaScript fan and has previously reviewed a few books on jQuery
and JavaScript. He is a Linux enthusiast and a big proponent of the OSS movement.
He believes that software should always be free to actualize its true potential.
A true geek at heart, he spends some of his leisure time writing code in the hope
that it may be helpful to the masses. You can find more information on him at
http://mihirmone.apphb.com.
He is also a motorsport junkie, so you may find him loitering around the race tracks
from time to time (especially if Formula 1 is involved).
www.it-ebooks.info
Takeharu Oshida works at a small start-up, Mobilus (http://mobilus.co.jp/).
Mobilus provides a real-time communication platform and SDK called Konnect.
As a JavaScript engineer, he designs APIs, writes code and tests, activates EC2
instances, and deploys code. In other words, he is involved in everything, from
frontend to backend.
Juri strongly believes in the fact that automated testing approaches have a positive
impact on software quality and, ultimately, also contribute to the developer's own
productivity.
When not coding, Juri is either training or teaching Yoseikan Budo, a martial art form
in which he currently owns a 2nd Dan black belt. You can follow him on Twitter at
@juristr or visit his blog at http://juristr.com to catch up with him.
www.it-ebooks.info
www.PacktPub.com
Did you know that Packt offers eBook versions of every book published, with PDF
and ePub files available? You can upgrade to the eBook version at www.PacktPub.
com and, as a print book customer, you are entitled to a discount on the eBook copy.
Get in touch with us at [email protected] for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign
up for a range of free newsletters and receive exclusive discounts and offers on Packt
books and eBooks.
TM
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital
book library. Here, you can search, access, and read Packt's entire library of books.
Why subscribe?
• Fully searchable across every book published by Packt
• Copy-and-paste, print, and bookmark content
• On-demand and accessible via a web browser
www.it-ebooks.info
www.it-ebooks.info
Table of Contents
Preface 1
Chapter 1: Welcome to BDD 7
The test-first approach 7
The test-first cycle 9
Write a failing test 10
Make the test pass 10
Clean the code 11
Repeat! 12
Consequences of the test-first cycle 13
BDD versus TDD 14
Exploring unit testing 16
The structure of a test 21
Test doubles 22
What is a good test? 23
Summary 24
Chapter 2: Automating Tests with Mocha, Chai, and Sinon 27
Node and NPM as development platforms 27
Installing Node and NPM 28
Configuring your project with NPM 29
Introducing Mocha 32
Useful options in Mocha 35
Our first test-first cycle 37
More expressive assertions with Chai 41
Working with the "should" interface 45
Red/Green/Refactor 47
Parameterized tests 56
Organizing your setup 58
Defining test scenarios 63
www.it-ebooks.info
Table of Contents
[ ii ]
www.it-ebooks.info
Table of Contents
[ iii ]
www.it-ebooks.info
Table of Contents
[ iv ]
www.it-ebooks.info
Table of Contents
[v]
www.it-ebooks.info
www.it-ebooks.info
Other documents randomly have
different content
Une maison quelconque en un quartier perdu...
Le long couloir muet... L’escalier vermoulu,
Puis un palier, un rais de lumière, une porte...
Une servante avec un visage de morte
Me conduit. Des tapis où des êtres humains
Sont couchés au milieu de l’ombre et des coussins.
Les visages épais ont des regards sans flamme.
On distingue des seins et des bustes de femme
Et la fumée est lourde et je demeure là
Sous le miroir sans fin qui reflète un Bouddha
Et les peines du soir à mes côtés s’endorment.
Alors, un long visage clair, parmi les formes
Apparaît, il sourit, il se penche sur moi,
Sur ses lèvres se pose un minuscule doigt,
Qui fait chut! j’entends mal des choses à voix basse,
Je sens qu’un beau secret dans l’atmosphère passe...
Mais soudain un peignoir fait en se déplaçant
Un grand cercle couleur d’émeraude et de sang,
Comme un jet de cristal en flamme un rire fuse,
Les contours sont moins nets, les formes plus confuses
Et le visage au clair ovale disparaît...
Jamais je ne saurai quel était le secret.
LES DIEUX SUR LES QUAIS
Rentrer chez soi tout seul! Tout vaut mieux que le mal
De l’allumette avec son éclair sépulcral
Dans l’escalier, que tous ces seuils inexorables,
Que l’appartement froid, la lampe sur la table,
Le livre ouvert, le lit, ce berceau des remords,
Et le morne sommeil, frère obscur de la mort.
VIOL DE FILLE