SlideShare a Scribd company logo
1 of 74
JavaScript Unit Testing Tools of the trade
Christian Johansen ,[object Object],[object Object],[object Object],[object Object]
Table of Contents ,[object Object],[object Object],[object Object]
Why unit test JavaScript?
Debugging
 
console.log
 
 
F5, F5, F5
 
 
 
 
 
 
 
Which version? ,[object Object],[object Object],[object Object],[object Object]
What about mobile?
Manual testing ,[object Object]
Manual testing ,[object Object]
Manual testing It's time consuming
Automated unit tests
Unit tests ,[object Object],[object Object],[object Object]
How to unit test JavaScript? ,[object Object],[object Object],[object Object]
In-Browser Frameworks
YUI Test Part of the YUI Framework Can test any code Typical in-browser test framework http://developer.yahoo.com/yui/3/test/
YUI Test 2
YUI Test 3
HTML Fixture loads test
Code To Test: strftime
strftime Overview
Date formats
Unit Test (YUI 3)
The Good Parts ,[object Object],[object Object],[object Object],[object Object]
The Bad Parts ,[object Object],[object Object],[object Object],[object Object]
Similar offerings ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Headless frameworks
JSpec ,[object Object],[object Object],[object Object],[object Object],[object Object]
HTML Fixture
JSpec Spec
Run From Command Line
Result
Headless Run
The Good Parts ,[object Object],[object Object]
More Good Parts ,[object Object],[object Object],[object Object],[object Object],[object Object]
JSpec Goodness ,[object Object],[object Object],[object Object]
The Bad Parts ,[object Object],[object Object],[object Object]
Hybrids
JsTestDriver
The JsTestDriver Way ,[object Object],[object Object],[object Object],[object Object]
Running Tests ,[object Object],[object Object],[object Object]
JsTestDriver Server ,[object Object]
 
 
 
 
JsTestDriver Config
JsTestDriver Test
Run From Command Line
100% More Color
Uh-oh!
Run in Eclipse
The Good Parts ,[object Object],[object Object],[object Object]
More Good Parts ,[object Object],[object Object],[object Object]
Continuous Integration
JUnit XML Output
Hudson
 
 
Mocks and Stubs Working on it! http://gitorious.org/sinon
Quick Live Demo
Want More? Out Fall 2010 Rough cuts available: http://my.safaribooksonline.com/9780321684097
That's it! ,[object Object],[object Object],[object Object],[object Object]

More Related Content

What's hot

Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012Hazem Saleh
 
Building testable chrome extensions
Building testable chrome extensionsBuilding testable chrome extensions
Building testable chrome extensionsSeth McLaughlin
 
Automated Testing with Cucumber, PhantomJS and Selenium
Automated Testing with Cucumber, PhantomJS and SeleniumAutomated Testing with Cucumber, PhantomJS and Selenium
Automated Testing with Cucumber, PhantomJS and SeleniumDev9Com
 
Automated Testing using JavaScript
Automated Testing using JavaScriptAutomated Testing using JavaScript
Automated Testing using JavaScriptSimon Guest
 
Test-Driven JavaScript Development (JavaZone 2010)
Test-Driven JavaScript Development (JavaZone 2010)Test-Driven JavaScript Development (JavaZone 2010)
Test-Driven JavaScript Development (JavaZone 2010)Christian Johansen
 
Test your Javascript! v1.1
Test your Javascript! v1.1Test your Javascript! v1.1
Test your Javascript! v1.1Eric Wendelin
 
Protractor for angularJS
Protractor for angularJSProtractor for angularJS
Protractor for angularJSKrishna Kumar
 
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)Cogapp
 
Test automation with php codeception
Test automation with php codeceptionTest automation with php codeception
Test automation with php codeceptionbuddhieash
 
Browser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsBrowser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsLuís Bastião Silva
 
Codeception: introduction to php testing (v2 - Aberdeen php)
Codeception: introduction to php testing (v2 - Aberdeen php)Codeception: introduction to php testing (v2 - Aberdeen php)
Codeception: introduction to php testing (v2 - Aberdeen php)Engineor
 
Jest: Frontend Testing richtig gemacht @WebworkerNRW
Jest: Frontend Testing richtig gemacht @WebworkerNRWJest: Frontend Testing richtig gemacht @WebworkerNRW
Jest: Frontend Testing richtig gemacht @WebworkerNRWHolger Grosse-Plankermann
 
Code igniter unittest-part1
Code igniter unittest-part1Code igniter unittest-part1
Code igniter unittest-part1Albert Rosa
 
CodeIgniter Ant Scripting
CodeIgniter Ant ScriptingCodeIgniter Ant Scripting
CodeIgniter Ant ScriptingAlbert Rosa
 
Automated testing in Drupal
Automated testing in DrupalAutomated testing in Drupal
Automated testing in DrupalArtem Berdishev
 
UI Testing Automation - Alex Kalinovsky - CreamTec LLC
UI Testing Automation - Alex Kalinovsky - CreamTec LLCUI Testing Automation - Alex Kalinovsky - CreamTec LLC
UI Testing Automation - Alex Kalinovsky - CreamTec LLCJim Lane
 
Automated php unit testing in drupal 8
Automated php unit testing in drupal 8Automated php unit testing in drupal 8
Automated php unit testing in drupal 8Jay Friendly
 
Meetup React Sanca - 29/11/18 - React Testing
Meetup React Sanca - 29/11/18 - React TestingMeetup React Sanca - 29/11/18 - React Testing
Meetup React Sanca - 29/11/18 - React TestingAugusto Lazaro
 
Xdebug and Drupal8 tests (PhpUnit and Simpletest)
Xdebug and Drupal8 tests (PhpUnit and Simpletest)Xdebug and Drupal8 tests (PhpUnit and Simpletest)
Xdebug and Drupal8 tests (PhpUnit and Simpletest)Francisco José Seva Mora
 

What's hot (20)

Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012
 
Building testable chrome extensions
Building testable chrome extensionsBuilding testable chrome extensions
Building testable chrome extensions
 
Automated Testing with Cucumber, PhantomJS and Selenium
Automated Testing with Cucumber, PhantomJS and SeleniumAutomated Testing with Cucumber, PhantomJS and Selenium
Automated Testing with Cucumber, PhantomJS and Selenium
 
Automated Testing using JavaScript
Automated Testing using JavaScriptAutomated Testing using JavaScript
Automated Testing using JavaScript
 
Test-Driven JavaScript Development (JavaZone 2010)
Test-Driven JavaScript Development (JavaZone 2010)Test-Driven JavaScript Development (JavaZone 2010)
Test-Driven JavaScript Development (JavaZone 2010)
 
Test your Javascript! v1.1
Test your Javascript! v1.1Test your Javascript! v1.1
Test your Javascript! v1.1
 
Protractor for angularJS
Protractor for angularJSProtractor for angularJS
Protractor for angularJS
 
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
 
Test automation with php codeception
Test automation with php codeceptionTest automation with php codeception
Test automation with php codeception
 
Browser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsBrowser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.js
 
Codeception: introduction to php testing (v2 - Aberdeen php)
Codeception: introduction to php testing (v2 - Aberdeen php)Codeception: introduction to php testing (v2 - Aberdeen php)
Codeception: introduction to php testing (v2 - Aberdeen php)
 
Jest: Frontend Testing richtig gemacht @WebworkerNRW
Jest: Frontend Testing richtig gemacht @WebworkerNRWJest: Frontend Testing richtig gemacht @WebworkerNRW
Jest: Frontend Testing richtig gemacht @WebworkerNRW
 
Code igniter unittest-part1
Code igniter unittest-part1Code igniter unittest-part1
Code igniter unittest-part1
 
Protractor survival guide
Protractor survival guideProtractor survival guide
Protractor survival guide
 
CodeIgniter Ant Scripting
CodeIgniter Ant ScriptingCodeIgniter Ant Scripting
CodeIgniter Ant Scripting
 
Automated testing in Drupal
Automated testing in DrupalAutomated testing in Drupal
Automated testing in Drupal
 
UI Testing Automation - Alex Kalinovsky - CreamTec LLC
UI Testing Automation - Alex Kalinovsky - CreamTec LLCUI Testing Automation - Alex Kalinovsky - CreamTec LLC
UI Testing Automation - Alex Kalinovsky - CreamTec LLC
 
Automated php unit testing in drupal 8
Automated php unit testing in drupal 8Automated php unit testing in drupal 8
Automated php unit testing in drupal 8
 
Meetup React Sanca - 29/11/18 - React Testing
Meetup React Sanca - 29/11/18 - React TestingMeetup React Sanca - 29/11/18 - React Testing
Meetup React Sanca - 29/11/18 - React Testing
 
Xdebug and Drupal8 tests (PhpUnit and Simpletest)
Xdebug and Drupal8 tests (PhpUnit and Simpletest)Xdebug and Drupal8 tests (PhpUnit and Simpletest)
Xdebug and Drupal8 tests (PhpUnit and Simpletest)
 

Viewers also liked

PIano Integrato Politiche Familiari
PIano Integrato Politiche FamiliariPIano Integrato Politiche Familiari
PIano Integrato Politiche Familiaridavidenigro
 
080906 Apiq Matematika Kreatif Share
080906 Apiq Matematika Kreatif Share080906 Apiq Matematika Kreatif Share
080906 Apiq Matematika Kreatif ShareAgus Nggermanto
 
Vessier's NURS 4113 course
Vessier's NURS 4113 courseVessier's NURS 4113 course
Vessier's NURS 4113 courseAmanda Lemon
 
Functional JavaScript Fundamentals
Functional JavaScript FundamentalsFunctional JavaScript Fundamentals
Functional JavaScript FundamentalsSrdjan Strbanovic
 
Selling sustainability-from-inside-full-report1
Selling sustainability-from-inside-full-report1Selling sustainability-from-inside-full-report1
Selling sustainability-from-inside-full-report1Don Carli
 
SECU4 SA - Switzerland
SECU4 SA - SwitzerlandSECU4 SA - Switzerland
SECU4 SA - SwitzerlandSECU4 SA
 
Bedre tilgjengelighet med HTML og CSS
Bedre tilgjengelighet med HTML og CSSBedre tilgjengelighet med HTML og CSS
Bedre tilgjengelighet med HTML og CSSChristian Johansen
 

Viewers also liked (7)

PIano Integrato Politiche Familiari
PIano Integrato Politiche FamiliariPIano Integrato Politiche Familiari
PIano Integrato Politiche Familiari
 
080906 Apiq Matematika Kreatif Share
080906 Apiq Matematika Kreatif Share080906 Apiq Matematika Kreatif Share
080906 Apiq Matematika Kreatif Share
 
Vessier's NURS 4113 course
Vessier's NURS 4113 courseVessier's NURS 4113 course
Vessier's NURS 4113 course
 
Functional JavaScript Fundamentals
Functional JavaScript FundamentalsFunctional JavaScript Fundamentals
Functional JavaScript Fundamentals
 
Selling sustainability-from-inside-full-report1
Selling sustainability-from-inside-full-report1Selling sustainability-from-inside-full-report1
Selling sustainability-from-inside-full-report1
 
SECU4 SA - Switzerland
SECU4 SA - SwitzerlandSECU4 SA - Switzerland
SECU4 SA - Switzerland
 
Bedre tilgjengelighet med HTML og CSS
Bedre tilgjengelighet med HTML og CSSBedre tilgjengelighet med HTML og CSS
Bedre tilgjengelighet med HTML og CSS
 

Similar to JavaScript Unit Testing

Automated Web Testing With Selenium
Automated Web Testing With SeleniumAutomated Web Testing With Selenium
Automated Web Testing With SeleniumJodie Miners
 
Front-End Testing: Demystified
Front-End Testing: DemystifiedFront-End Testing: Demystified
Front-End Testing: DemystifiedSeth McLaughlin
 
Web Test Automation Framework - IndicThreads Conference
Web Test Automation Framework  - IndicThreads ConferenceWeb Test Automation Framework  - IndicThreads Conference
Web Test Automation Framework - IndicThreads ConferenceIndicThreads
 
Stepin evening presented
Stepin evening presentedStepin evening presented
Stepin evening presentedVijayan Reddy
 
Passing The Joel Test In The PHP World
Passing The Joel Test In The PHP WorldPassing The Joel Test In The PHP World
Passing The Joel Test In The PHP WorldLorna Mitchell
 
Joomla! Testing - J!DD Germany 2016
Joomla! Testing - J!DD Germany 2016Joomla! Testing - J!DD Germany 2016
Joomla! Testing - J!DD Germany 2016Yves Hoppe
 
Automated Web Testing using JavaScript
Automated Web Testing using JavaScriptAutomated Web Testing using JavaScript
Automated Web Testing using JavaScriptSimon Guest
 
Functional Testing Swing Applications with Frankenstein
Functional Testing Swing Applications with FrankensteinFunctional Testing Swing Applications with Frankenstein
Functional Testing Swing Applications with Frankensteinvivek_prahlad
 
[DevDay 2017] Automation Testing - Speaker: Nghia Khuong - Project Manager at...
[DevDay 2017] Automation Testing - Speaker: Nghia Khuong - Project Manager at...[DevDay 2017] Automation Testing - Speaker: Nghia Khuong - Project Manager at...
[DevDay 2017] Automation Testing - Speaker: Nghia Khuong - Project Manager at...DevDay.org
 
Building JBoss AS 7 for Fedora
Building JBoss AS 7 for FedoraBuilding JBoss AS 7 for Fedora
Building JBoss AS 7 for Fedorawolfc71
 
Mastering selenium for automated acceptance tests
Mastering selenium for automated acceptance testsMastering selenium for automated acceptance tests
Mastering selenium for automated acceptance testsNick Belhomme
 
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!Puneet Kala
 
Selenium2 and Jenkins: Almost pain-free UI Testing
Selenium2 and Jenkins: Almost pain-free UI TestingSelenium2 and Jenkins: Almost pain-free UI Testing
Selenium2 and Jenkins: Almost pain-free UI Testingmikereedell
 
Testing Java Web Apps With Selenium
Testing Java Web Apps With SeleniumTesting Java Web Apps With Selenium
Testing Java Web Apps With SeleniumMarakana Inc.
 

Similar to JavaScript Unit Testing (20)

Automated Web Testing With Selenium
Automated Web Testing With SeleniumAutomated Web Testing With Selenium
Automated Web Testing With Selenium
 
Front-End Testing: Demystified
Front-End Testing: DemystifiedFront-End Testing: Demystified
Front-End Testing: Demystified
 
Testing Toolbox
Testing ToolboxTesting Toolbox
Testing Toolbox
 
Web Test Automation Framework - IndicThreads Conference
Web Test Automation Framework  - IndicThreads ConferenceWeb Test Automation Framework  - IndicThreads Conference
Web Test Automation Framework - IndicThreads Conference
 
Stepin evening presented
Stepin evening presentedStepin evening presented
Stepin evening presented
 
Passing The Joel Test In The PHP World
Passing The Joel Test In The PHP WorldPassing The Joel Test In The PHP World
Passing The Joel Test In The PHP World
 
Joomla! Testing - J!DD Germany 2016
Joomla! Testing - J!DD Germany 2016Joomla! Testing - J!DD Germany 2016
Joomla! Testing - J!DD Germany 2016
 
QSpiders - Automation using Selenium
QSpiders - Automation using SeleniumQSpiders - Automation using Selenium
QSpiders - Automation using Selenium
 
Automated Web Testing using JavaScript
Automated Web Testing using JavaScriptAutomated Web Testing using JavaScript
Automated Web Testing using JavaScript
 
Selenium
SeleniumSelenium
Selenium
 
Functional Testing Swing Applications with Frankenstein
Functional Testing Swing Applications with FrankensteinFunctional Testing Swing Applications with Frankenstein
Functional Testing Swing Applications with Frankenstein
 
[DevDay 2017] Automation Testing - Speaker: Nghia Khuong - Project Manager at...
[DevDay 2017] Automation Testing - Speaker: Nghia Khuong - Project Manager at...[DevDay 2017] Automation Testing - Speaker: Nghia Khuong - Project Manager at...
[DevDay 2017] Automation Testing - Speaker: Nghia Khuong - Project Manager at...
 
Building JBoss AS 7 for Fedora
Building JBoss AS 7 for FedoraBuilding JBoss AS 7 for Fedora
Building JBoss AS 7 for Fedora
 
Mastering selenium for automated acceptance tests
Mastering selenium for automated acceptance testsMastering selenium for automated acceptance tests
Mastering selenium for automated acceptance tests
 
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
 
Selenium Introduction
Selenium IntroductionSelenium Introduction
Selenium Introduction
 
Selenium2 and Jenkins: Almost pain-free UI Testing
Selenium2 and Jenkins: Almost pain-free UI TestingSelenium2 and Jenkins: Almost pain-free UI Testing
Selenium2 and Jenkins: Almost pain-free UI Testing
 
Testing Java Web Apps With Selenium
Testing Java Web Apps With SeleniumTesting Java Web Apps With Selenium
Testing Java Web Apps With Selenium
 
Selenium (1)
Selenium (1)Selenium (1)
Selenium (1)
 
Selenium
SeleniumSelenium
Selenium
 

JavaScript Unit Testing