SlideShare une entreprise Scribd logo
1  sur  23
Javascript
    orientado a testes


        Alexandre Gomes
TDD
TDD
TDD
TDD
TDD
TDD
“     JsUnit is a Unit Testing
    framework for client-side
     (in-browser) JavaScript.
    It is essentially a port of
        JUnit to JavaScript

       http://www.jsunit.net/
“    Javascript Testing Framework using Rhino.

     This works similarly to other nUnit testing
     frameworks, though somewhat customized
    for javascript. It is exceedingly small, but also
                surprisingly powerful.




http://code.google.com/p/rhinounit/
“    JSSpec is a Javascript BDD
    (Behavior Driven Development)
            framework.



http://code.google.com/p/jsspec/
“   A Javascript BDD Framework
       with nested describes, a
    convenient assertion syntax,
    and an intuitive test browser.

https://github.com/nkallen/screw-unit
“   JSpec is a extremely small, yet very
       powerful testing framework.




http://visionmedia.github.com/jspec/
http://pivotal.github.com/jasmine/

        http://jsunity.com/

https://github.com/drnic/jsunittest

  http://j3unit.sourceforge.net/
$ jspec init helloworld
Template initialized at `helloworld'

$ ls
helloworld

$ cd helloworld/
helloworld $

helloworld $ ls
History.md Readme.md lib         spec

helloworld $ jspec run
seu código javascript




    arquivos que
  executam o seu
  código javascript



 arquivos de teste
lib/yourlib.js
spec/unit/spec.js
helloworld $ jspec run
spec/unit/spec.js
helloworld $ jspec run
helloworld $ jspec run --browsers Firefox
helloworld $ jspec run --rhino

Passes: 1 Failures: 0 Duration: 37 ms

Matematica
deveria somar dois numeros inteiros.

helloworld $
EXAMPLES:

  # Run once in default browser
  jspec run

  # Run once in Safari and Firefox
  jspec run --browsers Safari,Firefox

  # Run once in Opera, Firefox, Chrome, and WebKit
  jspec run --browsers opera,ff,chrome,webkit

  # Run custom spec file
  jspec run foo.html

  # Auto-run browsers when a file is altered
  jspec run --bind --browsers Safari,Firefox

  # Shortcut for the previous example
  jspec --browsers Safari,Firefox

  # Run Rhino specs
  jspec run --rhino

  # Auto-run rhino when a file is altered
  jspec --rhino
Matchers
•   be                  •   be_true
•   eql                 •   be_false
•   equal               •   be_type
•   be_a                •   be_greater_than
•   be_an               •   be_less_than
•   be_an_instance_of   •   have
•   be_at_least         •   have_at_least
•   be_at_most          •   have_at_most
•   be_within           •   have_within
•   be_null             •   have_length
•   be_undefined        •   have_prop
•   be_empty            •   have_property
P&R
Javascript orientado a testes
Javascript orientado a testes

Contenu connexe

Tendances

Integrating Browserify with Sprockets
Integrating Browserify with SprocketsIntegrating Browserify with Sprockets
Integrating Browserify with Sprockets
Spike Brehm
 
CoffeeScript presentation
CoffeeScript presentationCoffeeScript presentation
CoffeeScript presentation
John Lynch
 
Railsbridge javascript
Railsbridge   javascriptRailsbridge   javascript
Railsbridge javascript
p4geoff
 
festival ICT 2013: Ruby, the 0.8 language you were looking for
festival ICT 2013: Ruby, the 0.8 language you were looking forfestival ICT 2013: Ruby, the 0.8 language you were looking for
festival ICT 2013: Ruby, the 0.8 language you were looking for
festival ICT 2016
 

Tendances (20)

Ch. 8 script free pages
Ch. 8 script free pagesCh. 8 script free pages
Ch. 8 script free pages
 
Being a jsp
Being a jsp     Being a jsp
Being a jsp
 
Integrating Browserify with Sprockets
Integrating Browserify with SprocketsIntegrating Browserify with Sprockets
Integrating Browserify with Sprockets
 
Ch. 7 beeing a jsp
Ch. 7 beeing a jsp     Ch. 7 beeing a jsp
Ch. 7 beeing a jsp
 
CoffeeScript presentation
CoffeeScript presentationCoffeeScript presentation
CoffeeScript presentation
 
Padrino is agnostic
Padrino is agnosticPadrino is agnostic
Padrino is agnostic
 
Hello world
Hello worldHello world
Hello world
 
Ruby on Rails
Ruby on RailsRuby on Rails
Ruby on Rails
 
HelloWorld
HelloWorldHelloWorld
HelloWorld
 
4η διάλεξη Τεχνολογίες Παγκόσμιου Ιστού
4η διάλεξη Τεχνολογίες Παγκόσμιου Ιστού4η διάλεξη Τεχνολογίες Παγκόσμιου Ιστού
4η διάλεξη Τεχνολογίες Παγκόσμιου Ιστού
 
Ansible -new kid in configuration management world
Ansible -new kid in configuration management worldAnsible -new kid in configuration management world
Ansible -new kid in configuration management world
 
Fronted From Scratch - Supercharge Magento page speed
Fronted From Scratch - Supercharge Magento page speedFronted From Scratch - Supercharge Magento page speed
Fronted From Scratch - Supercharge Magento page speed
 
Black-Scholes Calculator on Web
Black-Scholes Calculator on WebBlack-Scholes Calculator on Web
Black-Scholes Calculator on Web
 
CoffeeScript - An Introduction
CoffeeScript - An IntroductionCoffeeScript - An Introduction
CoffeeScript - An Introduction
 
Reasons To Love Ruby
Reasons To Love RubyReasons To Love Ruby
Reasons To Love Ruby
 
Writing PHP – The WordPress Way! by Rahul Bansal @WordCamp Mumbai 2017
Writing PHP – The WordPress Way! by Rahul Bansal  @WordCamp Mumbai 2017Writing PHP – The WordPress Way! by Rahul Bansal  @WordCamp Mumbai 2017
Writing PHP – The WordPress Way! by Rahul Bansal @WordCamp Mumbai 2017
 
jQuery Performance Tips and Tricks
jQuery Performance Tips and TricksjQuery Performance Tips and Tricks
jQuery Performance Tips and Tricks
 
RubyGem
RubyGemRubyGem
RubyGem
 
Railsbridge javascript
Railsbridge   javascriptRailsbridge   javascript
Railsbridge javascript
 
festival ICT 2013: Ruby, the 0.8 language you were looking for
festival ICT 2013: Ruby, the 0.8 language you were looking forfestival ICT 2013: Ruby, the 0.8 language you were looking for
festival ICT 2013: Ruby, the 0.8 language you were looking for
 

En vedette

Fa cup semi final pricing 2012
Fa cup semi final pricing 2012Fa cup semi final pricing 2012
Fa cup semi final pricing 2012
Matt Gamble
 
Capitalismo e revoluções industriais (1)
Capitalismo e revoluções industriais (1)Capitalismo e revoluções industriais (1)
Capitalismo e revoluções industriais (1)
julio2012souto
 
A05 364 elevation
A05 364 elevationA05 364 elevation
A05 364 elevation
schrute1
 
gearlesstransmissionfinalppt-150322153503-conversion-gate01 (2)
gearlesstransmissionfinalppt-150322153503-conversion-gate01 (2)gearlesstransmissionfinalppt-150322153503-conversion-gate01 (2)
gearlesstransmissionfinalppt-150322153503-conversion-gate01 (2)
Rohit kumar vidyarthi
 

En vedette (20)

Trabajo Práctico Viamichelin-Paola Catán
Trabajo Práctico Viamichelin-Paola CatánTrabajo Práctico Viamichelin-Paola Catán
Trabajo Práctico Viamichelin-Paola Catán
 
Fa cup semi final pricing 2012
Fa cup semi final pricing 2012Fa cup semi final pricing 2012
Fa cup semi final pricing 2012
 
Aprendendo a Aprender
Aprendendo a AprenderAprendendo a Aprender
Aprendendo a Aprender
 
red zone
red zonered zone
red zone
 
Capitalismo e revoluções industriais (1)
Capitalismo e revoluções industriais (1)Capitalismo e revoluções industriais (1)
Capitalismo e revoluções industriais (1)
 
Export to russia 1198
Export to russia 1198Export to russia 1198
Export to russia 1198
 
Licencia Creative Commons
Licencia Creative CommonsLicencia Creative Commons
Licencia Creative Commons
 
A05 364 elevation
A05 364 elevationA05 364 elevation
A05 364 elevation
 
28[1]eletrico9
28[1]eletrico928[1]eletrico9
28[1]eletrico9
 
42[1]regras de sms
42[1]regras de sms42[1]regras de sms
42[1]regras de sms
 
Where To Go From Here: Implementation And The Way Forward
Where To Go From Here:  Implementation And The Way ForwardWhere To Go From Here:  Implementation And The Way Forward
Where To Go From Here: Implementation And The Way Forward
 
Concorso Allievi Marescialli Guardia di Finanza 2016 - Bando
Concorso Allievi Marescialli Guardia di Finanza 2016 - BandoConcorso Allievi Marescialli Guardia di Finanza 2016 - Bando
Concorso Allievi Marescialli Guardia di Finanza 2016 - Bando
 
O Φρίξος, η Έλλη και το χρυσόμαλλο δέρας
O Φρίξος, η Έλλη και το χρυσόμαλλο δέραςO Φρίξος, η Έλλη και το χρυσόμαλλο δέρας
O Φρίξος, η Έλλη και το χρυσόμαλλο δέρας
 
Catalogue 2016
Catalogue 2016Catalogue 2016
Catalogue 2016
 
Gearless transmission
Gearless transmissionGearless transmission
Gearless transmission
 
gearlesstransmissionfinalppt-150322153503-conversion-gate01 (2)
gearlesstransmissionfinalppt-150322153503-conversion-gate01 (2)gearlesstransmissionfinalppt-150322153503-conversion-gate01 (2)
gearlesstransmissionfinalppt-150322153503-conversion-gate01 (2)
 
Concorsi Accademie Militari 2016 - Bando
Concorsi Accademie Militari 2016 - BandoConcorsi Accademie Militari 2016 - Bando
Concorsi Accademie Militari 2016 - Bando
 
Concorso Allievi Agenti Polizia di Stato 2016 - Bando
Concorso Allievi Agenti Polizia di Stato 2016 - BandoConcorso Allievi Agenti Polizia di Stato 2016 - Bando
Concorso Allievi Agenti Polizia di Stato 2016 - Bando
 
Concorso Allievi Vicebrigadieri Carabinieri 21 Corso Trimestrale Quiz Banca Dati
Concorso Allievi Vicebrigadieri Carabinieri 21 Corso Trimestrale Quiz Banca DatiConcorso Allievi Vicebrigadieri Carabinieri 21 Corso Trimestrale Quiz Banca Dati
Concorso Allievi Vicebrigadieri Carabinieri 21 Corso Trimestrale Quiz Banca Dati
 
Ingles x d
Ingles x dIngles x d
Ingles x d
 

Similaire à Javascript orientado a testes

Web Development using Ruby on Rails
Web Development using Ruby on RailsWeb Development using Ruby on Rails
Web Development using Ruby on Rails
Avi Kedar
 
SXSW 2012 JavaScript MythBusters
SXSW 2012 JavaScript MythBustersSXSW 2012 JavaScript MythBusters
SXSW 2012 JavaScript MythBusters
Elena-Oana Tabaranu
 
The Peanut Butter Cup of Web-dev: Plack and single page web apps
The Peanut Butter Cup of Web-dev: Plack and single page web appsThe Peanut Butter Cup of Web-dev: Plack and single page web apps
The Peanut Butter Cup of Web-dev: Plack and single page web apps
John Anderson
 
AppeX and JavaScript Support Enhancements in Cincom Smalltalk
AppeX and JavaScript Support Enhancements in Cincom SmalltalkAppeX and JavaScript Support Enhancements in Cincom Smalltalk
AppeX and JavaScript Support Enhancements in Cincom Smalltalk
ESUG
 
JavaScript Fundamentals & JQuery
JavaScript Fundamentals & JQueryJavaScript Fundamentals & JQuery
JavaScript Fundamentals & JQuery
Jamshid Hashimi
 

Similaire à Javascript orientado a testes (20)

Leveling Up at JavaScript
Leveling Up at JavaScriptLeveling Up at JavaScript
Leveling Up at JavaScript
 
Building reusable components with generics and protocols
Building reusable components with generics and protocolsBuilding reusable components with generics and protocols
Building reusable components with generics and protocols
 
Web Development using Ruby on Rails
Web Development using Ruby on RailsWeb Development using Ruby on Rails
Web Development using Ruby on Rails
 
The Enterprise Strikes Back
The Enterprise Strikes BackThe Enterprise Strikes Back
The Enterprise Strikes Back
 
Jest: Frontend Testing richtig gemacht @WebworkerNRW
Jest: Frontend Testing richtig gemacht @WebworkerNRWJest: Frontend Testing richtig gemacht @WebworkerNRW
Jest: Frontend Testing richtig gemacht @WebworkerNRW
 
BP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesBP-6 Repository Customization Best Practices
BP-6 Repository Customization Best Practices
 
33rd degree
33rd degree33rd degree
33rd degree
 
JavaScript : A trending scripting language
JavaScript : A trending scripting languageJavaScript : A trending scripting language
JavaScript : A trending scripting language
 
Java script core
Java script coreJava script core
Java script core
 
SXSW 2012 JavaScript MythBusters
SXSW 2012 JavaScript MythBustersSXSW 2012 JavaScript MythBusters
SXSW 2012 JavaScript MythBusters
 
Lecture7
Lecture7Lecture7
Lecture7
 
Selenium Tips & Tricks - StarWest 2015
Selenium Tips & Tricks - StarWest 2015Selenium Tips & Tricks - StarWest 2015
Selenium Tips & Tricks - StarWest 2015
 
Java script unit testing
Java script unit testingJava script unit testing
Java script unit testing
 
Efficient JavaScript Development
Efficient JavaScript DevelopmentEfficient JavaScript Development
Efficient JavaScript Development
 
Solid and Sustainable Development in Scala
Solid and Sustainable Development in ScalaSolid and Sustainable Development in Scala
Solid and Sustainable Development in Scala
 
Agile JavaScript Testing
Agile JavaScript TestingAgile JavaScript Testing
Agile JavaScript Testing
 
Solid And Sustainable Development in Scala
Solid And Sustainable Development in ScalaSolid And Sustainable Development in Scala
Solid And Sustainable Development in Scala
 
The Peanut Butter Cup of Web-dev: Plack and single page web apps
The Peanut Butter Cup of Web-dev: Plack and single page web appsThe Peanut Butter Cup of Web-dev: Plack and single page web apps
The Peanut Butter Cup of Web-dev: Plack and single page web apps
 
AppeX and JavaScript Support Enhancements in Cincom Smalltalk
AppeX and JavaScript Support Enhancements in Cincom SmalltalkAppeX and JavaScript Support Enhancements in Cincom Smalltalk
AppeX and JavaScript Support Enhancements in Cincom Smalltalk
 
JavaScript Fundamentals & JQuery
JavaScript Fundamentals & JQueryJavaScript Fundamentals & JQuery
JavaScript Fundamentals & JQuery
 

Plus de Alexandre Gomes

Programação Funcional com Javascript
Programação Funcional com JavascriptProgramação Funcional com Javascript
Programação Funcional com Javascript
Alexandre Gomes
 
UnB/PPCA/CS2016 - Projeto 2
UnB/PPCA/CS2016 - Projeto 2UnB/PPCA/CS2016 - Projeto 2
UnB/PPCA/CS2016 - Projeto 2
Alexandre Gomes
 
Javascript do jeito certo
Javascript do jeito certoJavascript do jeito certo
Javascript do jeito certo
Alexandre Gomes
 

Plus de Alexandre Gomes (20)

Construção de Software - 1º/2017
Construção de Software - 1º/2017Construção de Software - 1º/2017
Construção de Software - 1º/2017
 
TDDing com Javascript
TDDing com JavascriptTDDing com Javascript
TDDing com Javascript
 
Programação Funcional com Javascript
Programação Funcional com JavascriptProgramação Funcional com Javascript
Programação Funcional com Javascript
 
UnB/PPCA/CS2016 - Projeto 2
UnB/PPCA/CS2016 - Projeto 2UnB/PPCA/CS2016 - Projeto 2
UnB/PPCA/CS2016 - Projeto 2
 
Javascript do jeito certo
Javascript do jeito certoJavascript do jeito certo
Javascript do jeito certo
 
Construção de Software - 1º/2016
Construção de Software - 1º/2016Construção de Software - 1º/2016
Construção de Software - 1º/2016
 
Plano de Ensino de Tópicos Avançados em Engenharia de Software
Plano de Ensino de Tópicos Avançados em Engenharia de SoftwarePlano de Ensino de Tópicos Avançados em Engenharia de Software
Plano de Ensino de Tópicos Avançados em Engenharia de Software
 
O Pensamento Ágil
O Pensamento ÁgilO Pensamento Ágil
O Pensamento Ágil
 
Manifesto 2.0
Manifesto 2.0Manifesto 2.0
Manifesto 2.0
 
Construção de Software - 1º semestre de 2014
Construção de Software - 1º semestre de 2014Construção de Software - 1º semestre de 2014
Construção de Software - 1º semestre de 2014
 
Business Modeling
Business ModelingBusiness Modeling
Business Modeling
 
Design Thinking
Design ThinkingDesign Thinking
Design Thinking
 
Manifesto Ágil
Manifesto ÁgilManifesto Ágil
Manifesto Ágil
 
Laboratório de Métodos Ágeis 1/2014 - Apresentação
Laboratório de Métodos Ágeis 1/2014 - ApresentaçãoLaboratório de Métodos Ágeis 1/2014 - Apresentação
Laboratório de Métodos Ágeis 1/2014 - Apresentação
 
Scraping by examples
Scraping by examplesScraping by examples
Scraping by examples
 
Scraping by examples
Scraping by examplesScraping by examples
Scraping by examples
 
OpenData, Web Semântica e afins.
OpenData, Web Semântica e afins.OpenData, Web Semântica e afins.
OpenData, Web Semântica e afins.
 
Javascript do jeito certo
Javascript do jeito certoJavascript do jeito certo
Javascript do jeito certo
 
Escolhas 2.0
Escolhas 2.0Escolhas 2.0
Escolhas 2.0
 
Computacao Invisivel
Computacao InvisivelComputacao Invisivel
Computacao Invisivel
 

Dernier

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Dernier (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
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...
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Javascript orientado a testes

  • 1. Javascript orientado a testes Alexandre Gomes
  • 3. JsUnit is a Unit Testing framework for client-side (in-browser) JavaScript. It is essentially a port of JUnit to JavaScript http://www.jsunit.net/
  • 4. Javascript Testing Framework using Rhino. This works similarly to other nUnit testing frameworks, though somewhat customized for javascript. It is exceedingly small, but also surprisingly powerful. http://code.google.com/p/rhinounit/
  • 5. JSSpec is a Javascript BDD (Behavior Driven Development) framework. http://code.google.com/p/jsspec/
  • 6. A Javascript BDD Framework with nested describes, a convenient assertion syntax, and an intuitive test browser. https://github.com/nkallen/screw-unit
  • 7. JSpec is a extremely small, yet very powerful testing framework. http://visionmedia.github.com/jspec/
  • 8. http://pivotal.github.com/jasmine/ http://jsunity.com/ https://github.com/drnic/jsunittest http://j3unit.sourceforge.net/
  • 9.
  • 10. $ jspec init helloworld Template initialized at `helloworld' $ ls helloworld $ cd helloworld/ helloworld $ helloworld $ ls History.md Readme.md lib spec helloworld $ jspec run
  • 11. seu código javascript arquivos que executam o seu código javascript arquivos de teste
  • 17. helloworld $ jspec run --browsers Firefox
  • 18. helloworld $ jspec run --rhino Passes: 1 Failures: 0 Duration: 37 ms Matematica deveria somar dois numeros inteiros. helloworld $
  • 19. EXAMPLES: # Run once in default browser jspec run # Run once in Safari and Firefox jspec run --browsers Safari,Firefox # Run once in Opera, Firefox, Chrome, and WebKit jspec run --browsers opera,ff,chrome,webkit # Run custom spec file jspec run foo.html # Auto-run browsers when a file is altered jspec run --bind --browsers Safari,Firefox # Shortcut for the previous example jspec --browsers Safari,Firefox # Run Rhino specs jspec run --rhino # Auto-run rhino when a file is altered jspec --rhino
  • 20. Matchers • be • be_true • eql • be_false • equal • be_type • be_a • be_greater_than • be_an • be_less_than • be_an_instance_of • have • be_at_least • have_at_least • be_at_most • have_at_most • be_within • have_within • be_null • have_length • be_undefined • have_prop • be_empty • have_property
  • 21. P&R

Notes de l'éditeur

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. TODO\n- Subclasse com chamada a A.call(this) no construtor\n\nRequisitos:\n- Ruby\n- RubyGems (ruby setup.rb)\n- JSpec (gem install jspec)\n