SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Destaque

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
 

Destaque (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
 

Semelhante a 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
 

Semelhante a 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
 

Mais 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
 

Mais 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
 

Último

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Último (20)

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
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
 
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
 
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...
 
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...
 
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
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
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
 
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)
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
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
 

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

Notas do Editor

  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