SlideShare une entreprise Scribd logo
1  sur  14
JavaScript Test Driven
Development using JsTestDriver,
 VS 2010, and WebStorm 4.0


  SpeakerRate - http://spkr8.com/t/11601
Who am I?
I am a Microsoft Certified Solution Developer and I’ve
been developing software since 1979. Since 2009, I have
been focused on developing mobile applications, for 
iPhone, Android, the mobile web, and Windows Phone 7.
What is JsTestDriver?
  JsTestDriver aims to help javascript
 developers use good TDD practices
and aims to make writing unit tests as
 easy as what already exists today for
            java with JUnit.
Why JsTestDriver?


• It is fast.
• It runs in the browser.
What is Test Driven
      Development?

• Write a test
• Run tests; watch new test fail
• Make the test pass
• Refactor to remove duplication
The Benefits of TDD

• Regression Testing
• Refactoring
• Cross-Browser Testing
• Serves as Code Documentation
• Helps Create Cleaner Code
Installation
•   Need Java, JRE only.
    http://www.java.com

•   Make sure your path points to the java.exe file

•   Get the latest version of JsTestDriver. http://code.google.com/p/js-test-driver/downloads/list

•   I normally will rename it from JsTestDriver-x.x.x.x.jar to simply JsTestDriver.jar

•   Create your tests and your classes to be tested

•   Create your configuration file in the project root

•   Be sure to save the configuration file as an ASCII file!
    File -> Advanced Save Options -> Encodings -> US-ASCII
Automating the
         JsTestDriver Server
•   Tools -> External Tools

•   Choose Add and for Title box enter: JsTestDriver Server Run

•   Command box enter: java.exe

•   Arguments box enter: -jar c:binJsTestDriver.jar --port 9876

•   Initial directory enter: $(SolutionDir)

•   Check Use Output window then click OK
Automating the
         JsTestDriver Runner
•   Tools -> External Tools

•   Choose Add and for Title box enter: JsTestDriver Run

•   Command box enter: java.exe

•   Arguments box enter: -jar c:binJsTestDriver.jar --tests all

•   Initial directory enter: $(ProjectDir)

•   Check Use Output window then click OK
Create a Test Project
With WebStorm and
           Visual Studio
•   From WebStorm Quick Start, choose Open Directory

•   Navigate to the your Visual Studio project

•   You may need to associate the jstestdriver.conf with a
    configuration file

•   Start the JsTestDriver Server (lower panel on screen)

•   Capture one or more browsers

•   Execute the tests
Summary
JsTestDriver makes it easier to
do Test Driven Development in
          JavaScript.
References

• http://code.google.com/p/js-test-driver/
• http://blog.jetbrains.com/webide/2011/10/javascript-
  unit-testing-support/
• http://slmoloch.blogspot.com/2009/08/how-to-run-
  jstestdriver-with-visual_02.html
Please Rate My Talk:
  SpeakerRate - http://spkr8.com/t/11601



  The Source Code is on GitHub at:
https://github.com/Rockncoder/JQMContacts

Contenu connexe

Plus de Troy Miles

Plus de Troy Miles (20)

Fast C++ Web Servers
Fast C++ Web ServersFast C++ Web Servers
Fast C++ Web Servers
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot Camp
 
AWS Lambda Function with Kotlin
AWS Lambda Function with KotlinAWS Lambda Function with Kotlin
AWS Lambda Function with Kotlin
 
React Native One Day
React Native One DayReact Native One Day
React Native One Day
 
React Native Evening
React Native EveningReact Native Evening
React Native Evening
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
React Development with the MERN Stack
React Development with the MERN StackReact Development with the MERN Stack
React Development with the MERN Stack
 
Angular Application Testing
Angular Application TestingAngular Application Testing
Angular Application Testing
 
ReactJS.NET
ReactJS.NETReactJS.NET
ReactJS.NET
 
What is Angular version 4?
What is Angular version 4?What is Angular version 4?
What is Angular version 4?
 
Angular Weekend
Angular WeekendAngular Weekend
Angular Weekend
 
From MEAN to the MERN Stack
From MEAN to the MERN StackFrom MEAN to the MERN Stack
From MEAN to the MERN Stack
 
Functional Programming in JavaScript
Functional Programming in JavaScriptFunctional Programming in JavaScript
Functional Programming in JavaScript
 
Functional Programming in Clojure
Functional Programming in ClojureFunctional Programming in Clojure
Functional Programming in Clojure
 
MEAN Stack Warm-up
MEAN Stack Warm-upMEAN Stack Warm-up
MEAN Stack Warm-up
 
The JavaScript You Wished You Knew
The JavaScript You Wished You KnewThe JavaScript You Wished You Knew
The JavaScript You Wished You Knew
 
Build a Game in 60 minutes
Build a Game in 60 minutesBuild a Game in 60 minutes
Build a Game in 60 minutes
 
Quick & Dirty & MEAN
Quick & Dirty & MEANQuick & Dirty & MEAN
Quick & Dirty & MEAN
 
A Quick Intro to ReactiveX
A Quick Intro to ReactiveXA Quick Intro to ReactiveX
A Quick Intro to ReactiveX
 
JavaScript Foundations Day1
JavaScript Foundations Day1JavaScript Foundations Day1
JavaScript Foundations Day1
 

Dernier

Dernier (20)

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
 
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...
 
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
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
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...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
"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 ...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.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
 
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
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
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
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
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...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
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
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
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
 

JavaScript Test Driven Development using JsTestDriver, VS 2010, and WebStorm 4.0

  • 1. JavaScript Test Driven Development using JsTestDriver, VS 2010, and WebStorm 4.0 SpeakerRate - http://spkr8.com/t/11601
  • 2. Who am I? I am a Microsoft Certified Solution Developer and I’ve been developing software since 1979. Since 2009, I have been focused on developing mobile applications, for  iPhone, Android, the mobile web, and Windows Phone 7.
  • 3. What is JsTestDriver? JsTestDriver aims to help javascript developers use good TDD practices and aims to make writing unit tests as easy as what already exists today for java with JUnit.
  • 4. Why JsTestDriver? • It is fast. • It runs in the browser.
  • 5. What is Test Driven Development? • Write a test • Run tests; watch new test fail • Make the test pass • Refactor to remove duplication
  • 6. The Benefits of TDD • Regression Testing • Refactoring • Cross-Browser Testing • Serves as Code Documentation • Helps Create Cleaner Code
  • 7. Installation • Need Java, JRE only. http://www.java.com • Make sure your path points to the java.exe file • Get the latest version of JsTestDriver. http://code.google.com/p/js-test-driver/downloads/list • I normally will rename it from JsTestDriver-x.x.x.x.jar to simply JsTestDriver.jar • Create your tests and your classes to be tested • Create your configuration file in the project root • Be sure to save the configuration file as an ASCII file! File -> Advanced Save Options -> Encodings -> US-ASCII
  • 8. Automating the JsTestDriver Server • Tools -> External Tools • Choose Add and for Title box enter: JsTestDriver Server Run • Command box enter: java.exe • Arguments box enter: -jar c:binJsTestDriver.jar --port 9876 • Initial directory enter: $(SolutionDir) • Check Use Output window then click OK
  • 9. Automating the JsTestDriver Runner • Tools -> External Tools • Choose Add and for Title box enter: JsTestDriver Run • Command box enter: java.exe • Arguments box enter: -jar c:binJsTestDriver.jar --tests all • Initial directory enter: $(ProjectDir) • Check Use Output window then click OK
  • 10. Create a Test Project
  • 11. With WebStorm and Visual Studio • From WebStorm Quick Start, choose Open Directory • Navigate to the your Visual Studio project • You may need to associate the jstestdriver.conf with a configuration file • Start the JsTestDriver Server (lower panel on screen) • Capture one or more browsers • Execute the tests
  • 12. Summary JsTestDriver makes it easier to do Test Driven Development in JavaScript.
  • 13. References • http://code.google.com/p/js-test-driver/ • http://blog.jetbrains.com/webide/2011/10/javascript- unit-testing-support/ • http://slmoloch.blogspot.com/2009/08/how-to-run- jstestdriver-with-visual_02.html
  • 14. Please Rate My Talk: SpeakerRate - http://spkr8.com/t/11601 The Source Code is on GitHub at: https://github.com/Rockncoder/JQMContacts

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