SlideShare a Scribd company logo
1 of 28
André Faria Gomes
   @andrefaria
Jasmine is a behavior-driven
development framework for testing
       your JavaScript code.
It does not depend on any other
    JavaScript frameworks
It does not require a DOM
It has a clean, obvious syntax so that
      you can easily write tests.
Specs
Expectations
Suites
Nested
Disabling



      describe => xdescribe
            it => xit
Matchers
 expect(x).toEqual(y);
 expect(x).toBe(y); //same
 expect(x).toMatch(pattern); //regex
 expect(x).toBeDefined(); //not undefined
 expect(x).toBeNull();
 expect(x).toBeTruthy();
 expect(x).toBeFalsy();
 expect(x).toContain(y); //for arrays or strings
 expect(x).toBeLessThan(y);
 expect(x).toBeGreaterThan(y);
 expect(fn).toThrow(e);
 expect(x).not.toEqual(y);
Your Matchers
Before & After
Spies
  Spies are automatically removed after each spec.
  They may be set in the beforeEach function
Spying Static Methods
Spying Instance Methods
Spying CallBacks
Spying AJAX
Spying Matchers
expect(x).toHaveBeenCalled()
expect(x).toHaveBeenCalledWith(arguments)
expect(x).not.toHaveBeenCalled()
expect(x).not.toHaveBeenCalledWith(arguments)


spyOn(x, 'method').andCallThrough(): spies on AND calls the original function spied on
spyOn(x, 'method').andReturn(arguments): returns passed arguments when spy is called
spyOn(x, 'method').andThrow(exception): throws passed exception when spy is called
spyOn(x, 'method').andCallFake(function): calls passed function when spy is called




Spy Properties
callCount: returns number of times spy was called
mostRecentCall.args: returns argument array from last call to spy.
argsForCall[i] returns arguments array for call i to spy.
Asynchronous Specs
   runs
Asynchronous Specs
   waiting
Asynchronous Specs
   waiting condiction
HTML               /src
SpecRunner.html   /spec
Ruby
Gem
NodeJS
package




     npm install jasmine-node --global
     jasmine-node scripts
Java
maven
References
https://github.com/pivotal/jasmine

More Related Content

What's hot

What's hot (20)

Conditional Statement in C Language
Conditional Statement in C LanguageConditional Statement in C Language
Conditional Statement in C Language
 
CONDITIONAL STATEMENT IN C LANGUAGE
CONDITIONAL STATEMENT IN C LANGUAGECONDITIONAL STATEMENT IN C LANGUAGE
CONDITIONAL STATEMENT IN C LANGUAGE
 
Conditional and control statement
Conditional and control statementConditional and control statement
Conditional and control statement
 
C lecture 3 control statements slideshare
C lecture 3 control statements slideshareC lecture 3 control statements slideshare
C lecture 3 control statements slideshare
 
Lecture04(control structure part i)
Lecture04(control structure part i)Lecture04(control structure part i)
Lecture04(control structure part i)
 
basic of desicion control statement in python
basic of  desicion control statement in pythonbasic of  desicion control statement in python
basic of desicion control statement in python
 
control statement
control statement control statement
control statement
 
5 c control statements looping
5  c control statements looping5  c control statements looping
5 c control statements looping
 
C if else
C if elseC if else
C if else
 
PHP MATERIAL
PHP MATERIALPHP MATERIAL
PHP MATERIAL
 
Selection Statements in C Programming
Selection Statements in C ProgrammingSelection Statements in C Programming
Selection Statements in C Programming
 
Control Statement programming
Control Statement programmingControl Statement programming
Control Statement programming
 
Php & my sql
Php & my sqlPhp & my sql
Php & my sql
 
SQL -PHP Tutorial
SQL -PHP TutorialSQL -PHP Tutorial
SQL -PHP Tutorial
 
Module 2- Control Structures
Module 2- Control StructuresModule 2- Control Structures
Module 2- Control Structures
 
Branching in C
Branching in CBranching in C
Branching in C
 
Control and conditional statements
Control and conditional statementsControl and conditional statements
Control and conditional statements
 
C++ STATEMENTS
C++ STATEMENTS C++ STATEMENTS
C++ STATEMENTS
 
Arrays
ArraysArrays
Arrays
 
Decision Control Structure If & Else
Decision Control Structure If & ElseDecision Control Structure If & Else
Decision Control Structure If & Else
 

Viewers also liked

Animating Digital Libraries
Animating Digital LibrariesAnimating Digital Libraries
Animating Digital Libraries
James Williamson
 
Resume of Cliff Daniels
Resume of Cliff DanielsResume of Cliff Daniels
Resume of Cliff Daniels
Cliff Daniels
 
HELVETASinNepal_60Years_20062016
HELVETASinNepal_60Years_20062016HELVETASinNepal_60Years_20062016
HELVETASinNepal_60Years_20062016
Tekendra Kumar Wod
 

Viewers also liked (18)

Tránsito en Bahía Blanca- Accidente de tránsito.
Tránsito en Bahía Blanca- Accidente de tránsito.Tránsito en Bahía Blanca- Accidente de tránsito.
Tránsito en Bahía Blanca- Accidente de tránsito.
 
Manual de practicas de solidworks
Manual de practicas de solidworksManual de practicas de solidworks
Manual de practicas de solidworks
 
Animating Digital Libraries
Animating Digital LibrariesAnimating Digital Libraries
Animating Digital Libraries
 
Pomodoro
PomodoroPomodoro
Pomodoro
 
DXi EXEC SUMMARY
DXi EXEC SUMMARYDXi EXEC SUMMARY
DXi EXEC SUMMARY
 
INTRODUCCION A LA INGENIERIA Y OTROS SABERES DEL SIGLO XXI
INTRODUCCION A LA INGENIERIA Y OTROS SABERES DEL SIGLO XXIINTRODUCCION A LA INGENIERIA Y OTROS SABERES DEL SIGLO XXI
INTRODUCCION A LA INGENIERIA Y OTROS SABERES DEL SIGLO XXI
 
DEspinoza_Resume
DEspinoza_ResumeDEspinoza_Resume
DEspinoza_Resume
 
emt nat. cert
emt nat. certemt nat. cert
emt nat. cert
 
MG Doyle Reference
MG Doyle ReferenceMG Doyle Reference
MG Doyle Reference
 
Resume of Cliff Daniels
Resume of Cliff DanielsResume of Cliff Daniels
Resume of Cliff Daniels
 
termodinamica y sus aplicaciones a los seres vivos
termodinamica y sus aplicaciones a los seres vivostermodinamica y sus aplicaciones a los seres vivos
termodinamica y sus aplicaciones a los seres vivos
 
Ptengine 「隠し要素」とは
Ptengine 「隠し要素」とはPtengine 「隠し要素」とは
Ptengine 「隠し要素」とは
 
HELVETASinNepal_60Years_20062016
HELVETASinNepal_60Years_20062016HELVETASinNepal_60Years_20062016
HELVETASinNepal_60Years_20062016
 
Sci10 tg u2
Sci10 tg u2Sci10 tg u2
Sci10 tg u2
 
ヒートマップで、アクセス解析・仮説検証力を磨く 先生:小原 良太郎
ヒートマップで、アクセス解析・仮説検証力を磨く 先生:小原 良太郎ヒートマップで、アクセス解析・仮説検証力を磨く 先生:小原 良太郎
ヒートマップで、アクセス解析・仮説検証力を磨く 先生:小原 良太郎
 
Actividad 5 ELEMENTOS DE LAS DIAPOSITIVAS
Actividad 5 ELEMENTOS DE LAS DIAPOSITIVAS Actividad 5 ELEMENTOS DE LAS DIAPOSITIVAS
Actividad 5 ELEMENTOS DE LAS DIAPOSITIVAS
 
Actividad 7
Actividad 7Actividad 7
Actividad 7
 
Actividad 10 6 g
Actividad 10 6 gActividad 10 6 g
Actividad 10 6 g
 

Similar to Testing Javascript with Jasmine

Javascript conditional statements 1
Javascript conditional statements 1Javascript conditional statements 1
Javascript conditional statements 1
Jesus Obenita Jr.
 
Clojure for Java developers - Stockholm
Clojure for Java developers - StockholmClojure for Java developers - Stockholm
Clojure for Java developers - Stockholm
Jan Kronquist
 
Scala design pattern
Scala design patternScala design pattern
Scala design pattern
Kenji Yoshida
 
javasebeyondbasics
javasebeyondbasicsjavasebeyondbasics
javasebeyondbasics
webuploader
 
Ekeko Technology Showdown at SoTeSoLa 2012
Ekeko Technology Showdown at SoTeSoLa 2012Ekeko Technology Showdown at SoTeSoLa 2012
Ekeko Technology Showdown at SoTeSoLa 2012
Coen De Roover
 

Similar to Testing Javascript with Jasmine (19)

Javascript conditional statements 1
Javascript conditional statements 1Javascript conditional statements 1
Javascript conditional statements 1
 
Regular Expressions: JavaScript And Beyond
Regular Expressions: JavaScript And BeyondRegular Expressions: JavaScript And Beyond
Regular Expressions: JavaScript And Beyond
 
JavaScript - Chapter 9 - TypeConversion and Regular Expressions
 JavaScript - Chapter 9 - TypeConversion and Regular Expressions  JavaScript - Chapter 9 - TypeConversion and Regular Expressions
JavaScript - Chapter 9 - TypeConversion and Regular Expressions
 
Jasmine BDD for Javascript
Jasmine BDD for JavascriptJasmine BDD for Javascript
Jasmine BDD for Javascript
 
Farewell to #define private public
Farewell to #define private publicFarewell to #define private public
Farewell to #define private public
 
PHP and MySQL
PHP and MySQLPHP and MySQL
PHP and MySQL
 
JSregularExpressions.pptx
JSregularExpressions.pptxJSregularExpressions.pptx
JSregularExpressions.pptx
 
Javascript - Break statement, type conversion, regular expression
Javascript - Break statement, type conversion, regular expressionJavascript - Break statement, type conversion, regular expression
Javascript - Break statement, type conversion, regular expression
 
JavaScript.pptx
JavaScript.pptxJavaScript.pptx
JavaScript.pptx
 
Clojure for Java developers - Stockholm
Clojure for Java developers - StockholmClojure for Java developers - Stockholm
Clojure for Java developers - Stockholm
 
Scala design pattern
Scala design patternScala design pattern
Scala design pattern
 
Javantura v3 - ES6 – Future Is Now – Nenad Pečanac
Javantura v3 - ES6 – Future Is Now – Nenad PečanacJavantura v3 - ES6 – Future Is Now – Nenad Pečanac
Javantura v3 - ES6 – Future Is Now – Nenad Pečanac
 
javasebeyondbasics
javasebeyondbasicsjavasebeyondbasics
javasebeyondbasics
 
Contracts in-clojure-pete
Contracts in-clojure-peteContracts in-clojure-pete
Contracts in-clojure-pete
 
javascript-variablesanddatatypes-130218094831-phpapp01.pdf
javascript-variablesanddatatypes-130218094831-phpapp01.pdfjavascript-variablesanddatatypes-130218094831-phpapp01.pdf
javascript-variablesanddatatypes-130218094831-phpapp01.pdf
 
JavaScript Unit Testing with an Angular 5.x Use Case 101
JavaScript Unit Testing with an Angular 5.x Use Case 101JavaScript Unit Testing with an Angular 5.x Use Case 101
JavaScript Unit Testing with an Angular 5.x Use Case 101
 
Ekeko Technology Showdown at SoTeSoLa 2012
Ekeko Technology Showdown at SoTeSoLa 2012Ekeko Technology Showdown at SoTeSoLa 2012
Ekeko Technology Showdown at SoTeSoLa 2012
 
Ecma script 5
Ecma script 5Ecma script 5
Ecma script 5
 
Lex and Yacc Tool M1.ppt
Lex and Yacc Tool M1.pptLex and Yacc Tool M1.ppt
Lex and Yacc Tool M1.ppt
 

More from André Faria Gomes

More from André Faria Gomes (20)

Meetup Escale - Gestão para Equipes de Alta Performance
Meetup Escale - Gestão para Equipes de Alta PerformanceMeetup Escale - Gestão para Equipes de Alta Performance
Meetup Escale - Gestão para Equipes de Alta Performance
 
Protagonistas da inovação - Como criar e gerir os negócios do futuro
Protagonistas da inovação - Como criar e gerir os negócios do futuroProtagonistas da inovação - Como criar e gerir os negócios do futuro
Protagonistas da inovação - Como criar e gerir os negócios do futuro
 
A Mobilidade como Propulsor da Transformação Digital
A Mobilidade como Propulsor da Transformação DigitalA Mobilidade como Propulsor da Transformação Digital
A Mobilidade como Propulsor da Transformação Digital
 
Além da Agilidade 2019 - KickOff Wow
Além da Agilidade 2019 - KickOff WowAlém da Agilidade 2019 - KickOff Wow
Além da Agilidade 2019 - KickOff Wow
 
Modern systems architectures: Uber, Lyft, Cabify
Modern systems architectures: Uber, Lyft, CabifyModern systems architectures: Uber, Lyft, Cabify
Modern systems architectures: Uber, Lyft, Cabify
 
Breaking the monolith
Breaking the monolithBreaking the monolith
Breaking the monolith
 
Agilidade - APAS
Agilidade - APASAgilidade - APAS
Agilidade - APAS
 
Principles and Radical Transparency - Lessons Learned from Ray Dalio
Principles and Radical Transparency - Lessons Learned from Ray DalioPrinciples and Radical Transparency - Lessons Learned from Ray Dalio
Principles and Radical Transparency - Lessons Learned from Ray Dalio
 
Bluesoft @ AWS re:Invent 2017 + AWS 101
Bluesoft @ AWS re:Invent 2017 + AWS 101Bluesoft @ AWS re:Invent 2017 + AWS 101
Bluesoft @ AWS re:Invent 2017 + AWS 101
 
Boas Práticas da Rede Supermercadista Wegmans
Boas Práticas da Rede Supermercadista WegmansBoas Práticas da Rede Supermercadista Wegmans
Boas Práticas da Rede Supermercadista Wegmans
 
Boas Práticas para Supermercadistas inspiradas no Whole Foods, Sprouts Marke...
Boas Práticas para Supermercadistas inspiradas no Whole Foods, Sprouts Marke...Boas Práticas para Supermercadistas inspiradas no Whole Foods, Sprouts Marke...
Boas Práticas para Supermercadistas inspiradas no Whole Foods, Sprouts Marke...
 
Change management - Kotter’s eight-step model
Change management - Kotter’s eight-step model Change management - Kotter’s eight-step model
Change management - Kotter’s eight-step model
 
Palestra na Uninove sobre Agilidade
Palestra na Uninove sobre AgilidadePalestra na Uninove sobre Agilidade
Palestra na Uninove sobre Agilidade
 
Pensando Rápido e Devagar
Pensando Rápido e DevagarPensando Rápido e Devagar
Pensando Rápido e Devagar
 
What happened to Google Reader?
What happened to Google Reader?What happened to Google Reader?
What happened to Google Reader?
 
Gestão Ágil com Management 3.0
Gestão Ágil com Management 3.0Gestão Ágil com Management 3.0
Gestão Ágil com Management 3.0
 
Lições aprendidas em 10 anos de agilidade
Lições aprendidas em 10 anos de agilidadeLições aprendidas em 10 anos de agilidade
Lições aprendidas em 10 anos de agilidade
 
Os 7 hábitos das pessoas altamente eficazes
Os 7 hábitos das pessoas altamente eficazesOs 7 hábitos das pessoas altamente eficazes
Os 7 hábitos das pessoas altamente eficazes
 
Objetividade: A Virtude Esquecida
Objetividade: A Virtude EsquecidaObjetividade: A Virtude Esquecida
Objetividade: A Virtude Esquecida
 
Bematech IFRS
Bematech IFRSBematech IFRS
Bematech IFRS
 

Recently uploaded

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
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

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
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
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...
 
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
 
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
 
"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 ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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...
 
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?
 
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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
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...
 
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
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 

Testing Javascript with Jasmine