Behavior-Driven Development in JavaScript



Sezgi Şensöz Tulum  @mefallit
Codefront.io  -  May 10, 2014 






Testing = Development methodology

Why is testing useful?  



waste of time?
find and fix bugs faster
prevents bugs from reappearing
avoid spending time to test again
keep our software design healthy
reliable documentation

Test Driven Development



What about BDD?




It's also TDD!!!
Not an evolved version of it..

TDD focuses on the developer's opinion
BDD on the user's opinion




TDD's perspective
When DomReadyEvent is triggered, app.showWelcomeMessage() will be executed.



BDD's perspective
When user enters the website,
 "Welcome" message will be shown.

BDD with Jasmine


BDD framework

Does not depend on any other JS frameworks

Does Not require a DOM
not re
quire a DOM
                        Works on browser
clean, obvious syntax




Meet Jasmine



Ups..



Spec and suites


Nested suites


Expectation and Matchers


Matchers



Before and After


Spies

* Watch class 
* Mocking 


Spies


Asynchronous specs




In JavaScript everything works on single treads.

But..

XHR requests and timer events?





How to install


Just download standalone version from github




Lets look inside..




Questions?

Contact Me




  • Twitter: @mefallit
  • Github: @mefallit
  • Mail: sezgisensoz@gmail.com
  • Linkedin: http://www.linkedin.com/in/ssensoz



bdd

By Sezgi Şensöz Tulum

bdd

Behavior-Driven Developement in JavaScript

  • 2,151