SlideShare ist ein Scribd-Unternehmen logo
1 von 88
 
Testing JavaScript with Jasmine By: Tim Tyrrell
Tim Tyrrell @timtyrrell    
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Why are you talking about JavaScript at a  Ruby conference?
Why unit test JavaScript?
"External tests don't help us with internal design" @glv
"There is only one way to go truly fast. Do the best job you can. Anything else is slower." @unclebobmartin http://twitter.com/#!/unclebobmartin/status/39438225869254656
 
What is Jasmine?
Why Jasmine?
Jasmine is not an integration testing framework.
RSpec vs. Jasmine: Structure #RSpec describe "Calculate" do      describe "#add" do          it "should return the sum" do              ...          end      end end //Jasmine describe "Calculate", function(){      describe "#Add", function(){          it "should return the sum", function(){          ...          };      }); });
RSpec vs. Jasmine: Before/After #RSpec before(:each) do           @calc = Calculator.new  end    after(:each) do           @calc.reset  end //Jasmine var calc;  beforeEach(function(){     calc = new Calculator(); });    afterEach(function(){     calc.reset();  });
RSpec vs. Jasmine: Expectations # RSpec  it "should return the sum" do       calc = Calculator.new        calc.add(1,1).should == 2     calc.add(1,2).should_not == 2 #Use one expectation per 'it'! end   // Jasmine  it("should return the sum", function() {           var calc = new Calculator();       expect(calc.Add(1,1)).toEqual(2);     expect(calc.Add(1,2)).not.toEqual(2); //Use one expectation per 'it'!  });
Jasmine Matchers expect(x).toEqual(y)   expect(x).toBe(y);   expect(x).toMatch(pattern)  expect(x).toBeDefined()  expect(x).toBeNull();   expect(x).toBeTruthy();  expect(x).toBeFalsy(); expect(x).toContain(y); expect(x).toBeLessThan(y); expect(x).toBeGreaterThan(y); expect(fn).toThrow(e);
Custom Matchers ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Custom Matchers ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Custom Matchers ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
RSpec vs. Jasmine: Stubbing # RSpec  it "should add the numbers" do       calc = Calculator.new       calc.stub!(:add).and_return(3)       calc.add(1,1).should == 3  end  // Jasmine  it("should add the numbers", function() {       var calc = new Calculator();       spyOn(calc, 'add').andReturn(3);      expect(calc.Add(1,1)).toEqual(3);  });
TDD? " Red ,  Green , Refactor"
Why do *I* like TDD?
Jasmine with "vanilla" JavaScript ,[object Object],[object Object],[object Object]
 
 
 
 
describe("Calculator", function() {    }); Spec for Calculator:
describe("Calculator", function() {   var calc;   beforeEach(function(){     calc = new Calculator();   }); }); Spec for Calculator:
describe("Calculator", function() {   var calc;   beforeEach(function(){     calc = new Calculator();   }); }); Spec for Calculator:
describe("Calculator", function() {   var calc;   beforeEach(function(){     calc = new Calculator();   });   it("should return the sum", function() {     expect(calc.Add(1,1)).toEqual(2);   }); }); Spec for Calculator:
Failing Test
Create the "Calculator" function ,[object Object],[object Object]
One passing, one left to fix
Add the method ,[object Object]
Passed!
Jasmine with Ruby(not Rails)
$ gem install jasmine
$ jasmine init
Generated folder structure
$ rake jasmine
http://localhost:8888
$ rake jasmine:ci
Jasmine with JQuery
     * toBe(jQuerySelector)     * toBeChecked()     * toBeEmpty()     * toBeHidden()     * toBeSelected()     * toBeVisible()     * toContain(jQuerySelector)     * toExist()     * toHaveAttr(attributeName, attributeValue)     * toHaveBeenTriggeredOn(selector)     * toHaveClass(className)     * toHaveData(key, value)     * toHaveHtml(string)     * toHaveId(id)     * toHaveText(string)     * toHaveValue(value)     * toBeDisabled() jasmine-jquery Matchers
&quot;A lightweight, easy to use Javascript <span> injector for radical Web Typography&quot;
@davatron5000
Lettering.js <h1 class=&quot;fancy_title&quot;>Some Title</h1> <script>    $(document).ready(function() {      $(&quot;.fancy_title&quot;).lettering();    }); </script>
Lettering.js results ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Standalone folder structure + more
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Jasmine with Rails gem &quot;jasmine&quot;  $ bundle install $ jasmine init (optional) $ rake jasmine or  $ rake jasmine:ci http://localhost:8888
Generated Rails spec folder
Generated default javascript objects
$ rake jasmine 
 
$ gem install evergreen
gem install evergreen
Evergreen default folder paths  (not generated)
$ evergreen serve
$ evergreen run
Evergreen and Rails 3 ,[object Object],[object Object]
What about CoffeeScript???
Installing CoffeeScript ,[object Object],[object Object],[object Object]
Add  a &quot;_spec.coffee&quot; file
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
#winning
 
Headless Browser Install ,[object Object],[object Object],[object Object]
Configure Evergreen ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Using a Headless Browser ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Node.js + Jasmine ,[object Object]
Any other cool utilities?
Rosie ,[object Object],[object Object]
Summer Breeze ,[object Object],[object Object]
jasminerice ,[object Object],[object Object]
http://try-jasmine.heroku.com
Wrap Up ,[object Object],[object Object],[object Object]
 
Thank You! @timtyrrell Questions? Did I miss any cool plugins? http://bit.ly/jasmine-lsrc http://spkr8.com/t/7818
http://pivotal.github.com/jasmine/ https://github.com/jnicklas/evergreen https://github.com/velesin/jasmine-jquery https://github.com/thoughtbot/capybara-webkit http://obtiva.com/blog/112-javascript-specs-with-jasmine-a-primer-for-rubyists-part-1 http://obtiva.com/blog/119 http://daverupert.com/2010/09/lettering-js/ http://www.engineyard.com/university/screencasts/javascript-tests-with-jasmine http://blog.levid.com/?p=29 http://blog.carbonfive.com/2010/10/21/rspec-best-practices/ https://github.com/johnbintz/guard-jasmine-headless-webkit References:

Weitere ähnliche Inhalte

Was ist angesagt?

Unit testing JavaScript using Mocha and Node
Unit testing JavaScript using Mocha and NodeUnit testing JavaScript using Mocha and Node
Unit testing JavaScript using Mocha and Node
Josh Mock
 

Was ist angesagt? (20)

JavaScript Test-Driven Development with Jasmine 2.0 and Karma
JavaScript Test-Driven Development with Jasmine 2.0 and Karma JavaScript Test-Driven Development with Jasmine 2.0 and Karma
JavaScript Test-Driven Development with Jasmine 2.0 and Karma
 
Unit testing JavaScript using Mocha and Node
Unit testing JavaScript using Mocha and NodeUnit testing JavaScript using Mocha and Node
Unit testing JavaScript using Mocha and Node
 
Intro to testing Javascript with jasmine
Intro to testing Javascript with jasmineIntro to testing Javascript with jasmine
Intro to testing Javascript with jasmine
 
Test-Driven Development of AngularJS Applications
Test-Driven Development of AngularJS ApplicationsTest-Driven Development of AngularJS Applications
Test-Driven Development of AngularJS Applications
 
Unit Testing Express Middleware
Unit Testing Express MiddlewareUnit Testing Express Middleware
Unit Testing Express Middleware
 
JavaScript TDD with Jasmine and Karma
JavaScript TDD with Jasmine and KarmaJavaScript TDD with Jasmine and Karma
JavaScript TDD with Jasmine and Karma
 
AngularJS Unit Testing w/Karma and Jasmine
AngularJS Unit Testing w/Karma and JasmineAngularJS Unit Testing w/Karma and Jasmine
AngularJS Unit Testing w/Karma and Jasmine
 
Unit testing in JavaScript with Jasmine and Karma
Unit testing in JavaScript with Jasmine and KarmaUnit testing in JavaScript with Jasmine and Karma
Unit testing in JavaScript with Jasmine and Karma
 
Testing JS with Jasmine
Testing JS with JasmineTesting JS with Jasmine
Testing JS with Jasmine
 
AngularJS Unit Testing
AngularJS Unit TestingAngularJS Unit Testing
AngularJS Unit Testing
 
Testing JavaScript Applications
Testing JavaScript ApplicationsTesting JavaScript Applications
Testing JavaScript Applications
 
Quick tour to front end unit testing using jasmine
Quick tour to front end unit testing using jasmineQuick tour to front end unit testing using jasmine
Quick tour to front end unit testing using jasmine
 
Full Stack Unit Testing
Full Stack Unit TestingFull Stack Unit Testing
Full Stack Unit Testing
 
Angularjs - Unit testing introduction
Angularjs - Unit testing introductionAngularjs - Unit testing introduction
Angularjs - Unit testing introduction
 
Angular JS Unit Testing - Overview
Angular JS Unit Testing - OverviewAngular JS Unit Testing - Overview
Angular JS Unit Testing - Overview
 
Unit Testing JavaScript Applications
Unit Testing JavaScript ApplicationsUnit Testing JavaScript Applications
Unit Testing JavaScript Applications
 
Unit Testing Express and Koa Middleware in ES2015
Unit Testing Express and Koa Middleware in ES2015Unit Testing Express and Koa Middleware in ES2015
Unit Testing Express and Koa Middleware in ES2015
 
SilverStripe CMS JavaScript Refactoring
SilverStripe CMS JavaScript RefactoringSilverStripe CMS JavaScript Refactoring
SilverStripe CMS JavaScript Refactoring
 
Workshop 5: JavaScript testing
Workshop 5: JavaScript testingWorkshop 5: JavaScript testing
Workshop 5: JavaScript testing
 
Practical Celery
Practical CeleryPractical Celery
Practical Celery
 

Andere mochten auch

Testing NodeJS with Mocha, Should, Sinon, and JSCoverage
Testing NodeJS with Mocha, Should, Sinon, and JSCoverageTesting NodeJS with Mocha, Should, Sinon, and JSCoverage
Testing NodeJS with Mocha, Should, Sinon, and JSCoverage
mlilley
 
TDD, unit testing and java script testing frameworks workshop
TDD, unit testing and java script testing frameworks workshopTDD, unit testing and java script testing frameworks workshop
TDD, unit testing and java script testing frameworks workshop
Sikandar Ahmed
 

Andere mochten auch (10)

Testing NodeJS with Mocha, Should, Sinon, and JSCoverage
Testing NodeJS with Mocha, Should, Sinon, and JSCoverageTesting NodeJS with Mocha, Should, Sinon, and JSCoverage
Testing NodeJS with Mocha, Should, Sinon, and JSCoverage
 
Testing Javascript Apps with Mocha and Chai
Testing Javascript Apps with Mocha and ChaiTesting Javascript Apps with Mocha and Chai
Testing Javascript Apps with Mocha and Chai
 
JavaScript Unit Testing
JavaScript Unit TestingJavaScript Unit Testing
JavaScript Unit Testing
 
Client side unit tests - using jasmine & karma
Client side unit tests - using jasmine & karmaClient side unit tests - using jasmine & karma
Client side unit tests - using jasmine & karma
 
Story about module management with angular.js
Story about module management with angular.jsStory about module management with angular.js
Story about module management with angular.js
 
TDD, unit testing and java script testing frameworks workshop
TDD, unit testing and java script testing frameworks workshopTDD, unit testing and java script testing frameworks workshop
TDD, unit testing and java script testing frameworks workshop
 
Angular testing
Angular testingAngular testing
Angular testing
 
Angular 2 - What's new and what's different
Angular 2 - What's new and what's differentAngular 2 - What's new and what's different
Angular 2 - What's new and what's different
 
Unit testing JavaScript: Jasmine & karma intro
Unit testing JavaScript: Jasmine & karma introUnit testing JavaScript: Jasmine & karma intro
Unit testing JavaScript: Jasmine & karma intro
 
Karma - JS Test Runner
Karma - JS Test RunnerKarma - JS Test Runner
Karma - JS Test Runner
 

Ähnlich wie Testing Javascript with Jasmine

Javascript Unit Testing
Javascript Unit TestingJavascript Unit Testing
Javascript Unit Testing
Paul Klipp
 
JavaScript Sprachraum
JavaScript SprachraumJavaScript Sprachraum
JavaScript Sprachraum
patricklee
 
Render API - Pavel Makhrinsky
Render API - Pavel MakhrinskyRender API - Pavel Makhrinsky
Render API - Pavel Makhrinsky
DrupalCampDN
 
Build Lightweight Web Module
Build Lightweight Web ModuleBuild Lightweight Web Module
Build Lightweight Web Module
Morgan Cheng
 

Ähnlich wie Testing Javascript with Jasmine (20)

Javascript Unit Testing
Javascript Unit TestingJavascript Unit Testing
Javascript Unit Testing
 
JQuery Basics
JQuery BasicsJQuery Basics
JQuery Basics
 
Exploiting Php With Php
Exploiting Php With PhpExploiting Php With Php
Exploiting Php With Php
 
Introduction to JQuery
Introduction to JQueryIntroduction to JQuery
Introduction to JQuery
 
Java Boilerplate Busters
Java Boilerplate BustersJava Boilerplate Busters
Java Boilerplate Busters
 
JavaScript Sprachraum
JavaScript SprachraumJavaScript Sprachraum
JavaScript Sprachraum
 
Jquery 1
Jquery 1Jquery 1
Jquery 1
 
Impacta - Show Day de Rails
Impacta - Show Day de RailsImpacta - Show Day de Rails
Impacta - Show Day de Rails
 
JavaScript, Beyond the Curly Braces
JavaScript, Beyond the Curly BracesJavaScript, Beyond the Curly Braces
JavaScript, Beyond the Curly Braces
 
Real life-coffeescript
Real life-coffeescriptReal life-coffeescript
Real life-coffeescript
 
Java Boilerplate Busters
Java Boilerplate BustersJava Boilerplate Busters
Java Boilerplate Busters
 
Spring Capitulo 05
Spring Capitulo 05Spring Capitulo 05
Spring Capitulo 05
 
Prototype js
Prototype jsPrototype js
Prototype js
 
JavaScript on Rails 튜토리얼
JavaScript on Rails 튜토리얼JavaScript on Rails 튜토리얼
JavaScript on Rails 튜토리얼
 
Ajax
AjaxAjax
Ajax
 
Php My Sql
Php My SqlPhp My Sql
Php My Sql
 
Render API - Pavel Makhrinsky
Render API - Pavel MakhrinskyRender API - Pavel Makhrinsky
Render API - Pavel Makhrinsky
 
Build Lightweight Web Module
Build Lightweight Web ModuleBuild Lightweight Web Module
Build Lightweight Web Module
 
KMUTNB - Internet Programming 5/7
KMUTNB - Internet Programming 5/7KMUTNB - Internet Programming 5/7
KMUTNB - Internet Programming 5/7
 
KMUTNB - Internet Programming 5/7
KMUTNB - Internet Programming 5/7KMUTNB - Internet Programming 5/7
KMUTNB - Internet Programming 5/7
 

Kürzlich hochgeladen

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Kürzlich hochgeladen (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 

Testing Javascript with Jasmine

Hinweis der Redaktion

  1. Tim Tyrrell, from Chicago, moved to Austin a year and a half ago. I work as a Rails Developer at PeopleAdmin in Austin, TX.  We have a SaaS talent management application with about 700 customers in the higher education, government, and non-profit sectors. Post jobs, apply to jobs, hiring workflows, etc.
  2. I appreciate you attending my session. I know that you have a choice today on which session to attend, so I plan to make a good use of your time. In accordance, I want to set your expectations by displaying my agenda. It is pretty slide heavy talk with lots of different code examples, but we will blow through them, so don&apos;t let that scare you. I know that I am what is standing between you and chicken fried chicken, so I will tread lightly here. This is an intro to testing with jasmine. Cover a lot of stuff briefly. So if you have ever worked with Jasmine, you may want to bail right now.
  3. - A lot of us use Ruby through Rails or Sinatra, so we have views, and these views use javascript. - I know that it is a gap in most applications. I think that is is something that might be scary but I want to show you that we can fill this gap and it is not very difficult. Although, it will take a mindset change.
  4. - it is code! - it can be very complex! -There was a time where it was though of as a toy language, but that misconception has obviously been blown away. -What is the problem? I think it&apos;s viewed like the wild wild west. You write a bunch of procedural script inside the views and any thought of testing code like that is impossible. Procedural  non-modular code, is horribly difficult to test. so right off the bat, you need to treat your javascript code with respect and care that you may backend code. Other perceived problems? Testing javascript is hard to get setup. - Why now? With javascript being more of an important piece of our software, with all this focus shifting to javascript, we need to do it right. Unit testing is the right way to do it. 
  5. - I know people say testing slows you down, but the reality is, a deployment that fails is going to slow you down. Refactoring some code and breaking half your application is going to slow you down. - yes, there are such things as spikes and prototypes where testing doesn&apos;t make sense. - what Obie said - testing is not easy. A know a number of folks in this room that have been doing it for 5+ years, and they are still learning new things and changing their opinions on the best way to do things. 
  6. Don&apos;t be this guy. You don&apos;t have to test-drive it, but you need to test it. The like unit testing because I don&apos;t want to get paged in the middle of the night.
  7. - Created by Pivitol Labs - there are other JS testing frameworks: QUnit is the most obvious one, which is used by the jQuery project. QUnit is more of a standard assertion framework where as Jasmine has the BDD style-syntax
  8. - super easy to get going and is super easy to use with Rails - Familiar RSpec Syntax (context switching is a killer) - It has a RubyGem for Ruby, Rails, or even Node.js. Also, you can use it without Ruby. - Easy to plug into a CI server, headless or not - Does not require the DOM - It does not depend on any other javascript frameworks - big community around it. Lot&apos;s of plugins and it is being pushed
  9. - This is for testing javascript in isolation. &amp;quot;Unit testing&amp;quot;   - More like Test::Unit or RSpec, JUnit, NUnit, etc.   - Not Cucumber, Capybara, etc.
  10. Differences? - With Rspec I could remove the double-quotes from &amp;quot;Calculate&amp;quot; and it will new that object up for us as the subject. - Rspec uses blocks and Jasmine uses anonymous functions - RSpec allows you to switch out the word describe for context and also there is some other syntactical magic you can us, Jasmine is straight forward.
  11. Differences? - this is the setup/teardown events - you can declare @calc in the before block in RSpec and it will be available in other blocks. Not so with Jasmine.
  12. - RSpec has different methods that define expectations, but Jasmine only has &amp;quot;expect&amp;quot; which is passed an argument and then chained with matchers. - To test negation you just chain on a &amp;quot;not&amp;quot; - Noel and the one assertion per &amp;quot;it&amp;quot;
  13. spec_helper.rb
  14. #spec helper.js
  15. - A &amp;quot;onSpy&amp;quot; call will remove the specified function from the object and replace it with a spy. This spy will absorb all calls to that method and you can optionally chain a return method on to it.
  16. - Test-Driven Development Write a failing test, make it pass, then make it better. Write a test before you write the code to make it pass. I will cover this quickly, it is something we have all heard a million times(I hope!). 
  17. - Attention span- Keeps me focused on one thing at a time. If I have a failing test, I know exactly what I am working on and will not bounce off onto a tangent or down a rabbit hole.   - Helps you design your API, because you are utilizing it for your tests - Helps me sleep at night. I can deploy and not be scared to death that something will break. - Keeps me moving fast. Make a change, run the tests, move on. Don&apos;t need to open the browser and click. - Give me confidence in major refactorings. (Same as above)
  18. - TDD manner!!!
  19. - open the html in a browser
  20. -  gem &apos;jasmine&apos; if bundler
  21. - create a folder
  22. - check out the default specs and functions - explain conventions. *Spec.js
  23. - fire up the web server
  24. - obviously used with Continuous Integration server. Selenium is run, browser opens closes, etc. - run it in the background while you work
  25. Jasmine has a number of libraries, one of them deals with jQuery a set of custom matchers for jQuery framework an API for handling HTML fixtures in your specs
  26. dom matchers, not object matchers
  27. - find grained control of your text - if you are going to refactor your code or add more features, you don&apos;t want to break anything. You need to pin down you existing functionality to keep yourself moving fast.
  28. Added a couple libraries and also a fixture directory.
  29. - no ruby required here
  30. - set the HTML or load a fixture from spec/javascripts - clears it after each run
  31. - using a jQuery selecting in the expect matcher
  32. - pinning down functionality
  33. Also you can rake jasmine:ci Dr. Phil next.
  34. Alright, that was the normal Jasmine way to get things set it. It is easy. But, it can be a little easier. There is a better way.
  35. Best of breed. Templates, no generators, and coffeescript support. Defaults with Selenium, but you can rock it with Capybara, whatever - not a stand alone, you need ruby (obviously)
  36. - folder conventions
  37. - CoffeeScript next - recap
  38. install node.js install npm install coffeescript
  39. - no different than the other evergreen usage of calculator_spec.js
  40. side by side.
  41. - this is how I felt after I did that. so what did I do? 1. installed the evergreen gem 2. mimicked a folder structure 3. added a file of a coffee extension
  42. capybara-webkit depends on a WebKit implementation from Qt, a cross-platform development toolkit. jasmine-headless-webkit uses the QtWebKit widget to run your specs without needing to render a pixel. It&apos;s nearly as fast as running in a JavaScript engine like Node.js, and, since it&apos;s a real browser environment, all the modules you would normally use, like jQuery and Backbone, work without any modifications.
  43. - guard-jasmine-headless-webkit
  44. - big problems - you get to work with me
  45. THANKS FOR LISTENING! It is easy to setup and use, and it will help you sleep better at night. Grow a neck beard.