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

Mais conteúdo relacionado

Mais de Troy Miles

Mais 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
 

Último

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
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Último (20)

Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
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
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
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
 
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
 
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 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
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
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
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
 
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
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
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
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 

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

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