SlideShare a Scribd company logo
1 of 13
Problem Statement / Target Ability to run JavaScript tests through commandline (not exactly headlessly) Integrate test results with the Bamboo build plan Visibility of code-coverage
Options for JS test-runner tools Env.js and Rhino.js V8 JavaScript Engine Jasmine-Maven plug-in Jasmine-Ruby plug-in Jasmine-JsTestDriver
Env.js & Rhino.js Uses its own JS engine Is more closer to Mozilla Firefox Still does not even behave as a mirror image of Firefox, on commandline Findings: behaves as a different browser in itself V8 JavaScript Engine Google's open source JavaScript engine, used in chrome Is a C++ code-base, needs to be compiled on local machine Pretty capable, supports Mozilla and chrome, not sure about Safari Findings: Pretty capable, but have not explored much
Jasmine-Maven Plug-in Uses HTMLUnit for headless browser runner HTMLUnit’s only supports Firefox and IE Findings – not capable to mock Safari capabilities Jasmine-Ruby Plug-in Has major issues with the “afterEach” and “toContains” Jasmine capabilities Can run with any browser – need to open the SpecRunner.html on the browser of choice !!! Findings – Promising, but needs to evolve
JsTestDriver
Why JsTestDriver Can run JS tests through commandline, on the browser(ant version) of choice Generates output in JUnit format, making it easier for Bamboo integration Well compatible with Jasmine Possesses code-coverage capability Had certain minor issues, which have a workaround now
Workarounds required for JTD Not fully compatible with prototype.js – required jar fix Jasmine spy issue, was unable to remove the spies – required Jasmine-JsTestDriver Adapter fix Never closes the browser tab when test-runner completes – added a minor apple-script fix
Testing with JTD jsTestDriver configuration server: http://localhost:9876 load:   - "tools/jasmine-test-driver/jasmine-1.0.1.js"   - "tools/jasmine-test-driver/JasmineAdapter.js"   - "tools/jasmine-test-driver/prototype-1.6.0.3.js"   - "dist/qowt-browser-unitTests.js" rake test java  -Xms512m -Xmx1024m  -jar tools/jasmine-test-driver/JsTestDriver-1.2.2.jar  --reset  --port 9876  --runnerMode DEBUG  --browser open  --tests all  --testOutput tests/test-reports
Creating test-append-area QOWT.TEST.UTILS = function() {     return {         /**          * creates dummy Test Append Area, and appends it to the document object, for running tests headlessly          * While executing tests on Sumulat, you get "testAppendArea" div present in the html body itself.          * But, in case of jsTestDriver, you do not have any such div present, and will have to create it on the fly.          * @return testAppendArea div           */ createTestAppendArea: function() { vartestAppendAreaContainer = document.getElementById('testAppendArea');             if(testAppendAreaContainer === null) { testAppendAreaContainer = document.createElement("div"); testAppendAreaContainer.innerHTML = '<div id="testAppendArea"></div>'; document.body.insert(testAppendAreaContainer);             }             return document.getElementById('testAppendArea');         }     }; }(); USAGE: (CommonContentMrg-test.js) testAppendArea = QOWT.TEST.UTILS.createTestAppendArea(); testAppendArea.appendChild(rootNode);
Code-Coverage with JTD rake coverage http://quicknet/display/PROD/Generating+Code+Coverage+Reports Coverage configurations server: http://localhost:9876 load:   - "../jasmine-1.0.1.js"   - "../JasmineAdapter.js"   - "../prototype-1.6.0.3.js"   - "../../../dist/qowt-browser-doc-sheet.js"   - "../../../dist/qowt-browser-point.js"   - "../../../dist/qowt-browser-testsOnly.js" plugin:  - name: "coverage"    jar: "tools/jasmine-test-driver/plugins/coverage-1.2.2.jar"    module: "com.google.jstestdriver.coverage.CoverageModule"
Debugging on JTD Start the server - java -Xms512m -Xmx1024m -jar tools/jasmine-test-driver/JsTestDriver-1.2.2.jar  --port 9876 Open the browser with the url- http://localhost:9876/capture Run the tests - java -Xms512m -Xmx1024m -jar tools/jasmine-test-driver/JsTestDriver-1.2.2.jar --tests all Apply the breakpoint Run the tests again
Known issue with JTD The rake script fails to close Safari window, if it has the developer console opened !!!
Questions … ?

More Related Content

What's hot

What's hot (20)

JavaScript Test-Driven Development with Jasmine 2.0 and Karma
JavaScript Test-Driven Development with Jasmine 2.0 and Karma JavaScript Test-Driven Development with Jasmine 2.0 and Karma
JavaScript Test-Driven Development with Jasmine 2.0 and Karma
 
Testing Web Applications
Testing Web ApplicationsTesting Web Applications
Testing Web Applications
 
Front-End Testing: Demystified
Front-End Testing: DemystifiedFront-End Testing: Demystified
Front-End Testing: Demystified
 
JavaScript TDD with Jasmine and Karma
JavaScript TDD with Jasmine and KarmaJavaScript TDD with Jasmine and Karma
JavaScript TDD with Jasmine and Karma
 
Nightwatch at Tilt
Nightwatch at TiltNightwatch at Tilt
Nightwatch at Tilt
 
AngularJS Unit Test
AngularJS Unit TestAngularJS Unit Test
AngularJS Unit Test
 
Quick tour to front end unit testing using jasmine
Quick tour to front end unit testing using jasmineQuick tour to front end unit testing using jasmine
Quick tour to front end unit testing using jasmine
 
클린코드를 위한 테스트 주도 개발 1장
클린코드를 위한 테스트 주도 개발 1장클린코드를 위한 테스트 주도 개발 1장
클린코드를 위한 테스트 주도 개발 1장
 
Automated Smoke Tests with Protractor
Automated Smoke Tests with ProtractorAutomated Smoke Tests with Protractor
Automated Smoke Tests with Protractor
 
An introduction to PhantomJS: A headless browser for automation test.
An introduction to PhantomJS: A headless browser for automation test.An introduction to PhantomJS: A headless browser for automation test.
An introduction to PhantomJS: A headless browser for automation test.
 
CasperJS and PhantomJS for Automated Testing
CasperJS and PhantomJS for Automated TestingCasperJS and PhantomJS for Automated Testing
CasperJS and PhantomJS for Automated Testing
 
Testing frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabsTesting frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabs
 
Detecting headless browsers
Detecting headless browsersDetecting headless browsers
Detecting headless browsers
 
前端網頁自動測試
前端網頁自動測試 前端網頁自動測試
前端網頁自動測試
 
Automated Testing with Ruby
Automated Testing with RubyAutomated Testing with Ruby
Automated Testing with Ruby
 
Unit testing in JavaScript with Jasmine and Karma
Unit testing in JavaScript with Jasmine and KarmaUnit testing in JavaScript with Jasmine and Karma
Unit testing in JavaScript with Jasmine and Karma
 
Advanced Jasmine - Front-End JavaScript Unit Testing
Advanced Jasmine - Front-End JavaScript Unit TestingAdvanced Jasmine - Front-End JavaScript Unit Testing
Advanced Jasmine - Front-End JavaScript Unit Testing
 
Unit testing JavaScript: Jasmine & karma intro
Unit testing JavaScript: Jasmine & karma introUnit testing JavaScript: Jasmine & karma intro
Unit testing JavaScript: Jasmine & karma intro
 
AngularJS performance & production tips
AngularJS performance & production tipsAngularJS performance & production tips
AngularJS performance & production tips
 
AngularJS Unit Testing w/Karma and Jasmine
AngularJS Unit Testing w/Karma and JasmineAngularJS Unit Testing w/Karma and Jasmine
AngularJS Unit Testing w/Karma and Jasmine
 

Viewers also liked

1 23 pv-aptw
1 23 pv-aptw1 23 pv-aptw
1 23 pv-aptw
NiekT
 

Viewers also liked (12)

การนับเวลาแบบสุริยคติ+547+54his p03 f03-4page
การนับเวลาแบบสุริยคติ+547+54his p03 f03-4pageการนับเวลาแบบสุริยคติ+547+54his p03 f03-4page
การนับเวลาแบบสุริยคติ+547+54his p03 f03-4page
 
NSR 1
NSR 1NSR 1
NSR 1
 
איך מעלים תיקיות לאחסון בגוגל דרייב
איך מעלים תיקיות לאחסון בגוגל דרייבאיך מעלים תיקיות לאחסון בגוגל דרייב
איך מעלים תיקיות לאחסון בגוגל דרייב
 
Diploma
DiplomaDiploma
Diploma
 
H uwtour
H uwtourH uwtour
H uwtour
 
1 23 pv-aptw
1 23 pv-aptw1 23 pv-aptw
1 23 pv-aptw
 
ביטול הרשאה ממי שלא בעל הקובץ
ביטול הרשאה ממי שלא בעל הקובץביטול הרשאה ממי שלא בעל הקובץ
ביטול הרשאה ממי שלא בעל הקובץ
 
Reseña gomez palacio 81 106
Reseña gomez palacio 81 106Reseña gomez palacio 81 106
Reseña gomez palacio 81 106
 
Resumen plan de estudios 2011 pimer grado
Resumen plan de estudios 2011 pimer gradoResumen plan de estudios 2011 pimer grado
Resumen plan de estudios 2011 pimer grado
 
MBA Without GMAT In Australia?
MBA Without GMAT In Australia?MBA Without GMAT In Australia?
MBA Without GMAT In Australia?
 
Acuerdo sobre víctimas
Acuerdo sobre víctimasAcuerdo sobre víctimas
Acuerdo sobre víctimas
 
Swift white paper_rmb_internationalisation_en
Swift white paper_rmb_internationalisation_enSwift white paper_rmb_internationalisation_en
Swift white paper_rmb_internationalisation_en
 

Similar to Jasmine with JS-Test-Driver

Javascript unit testing, yes we can e big
Javascript unit testing, yes we can   e bigJavascript unit testing, yes we can   e big
Javascript unit testing, yes we can e big
Andy Peterson
 
Test strategy for web development
Test strategy for web developmentTest strategy for web development
Test strategy for web development
alice yang
 
Automated javascript unit testing
Automated javascript unit testingAutomated javascript unit testing
Automated javascript unit testing
ryan_chambers
 
Compatibility Detector Tool of Chrome extensions
Compatibility Detector Tool of Chrome extensionsCompatibility Detector Tool of Chrome extensions
Compatibility Detector Tool of Chrome extensions
Kai Cui
 

Similar to Jasmine with JS-Test-Driver (20)

Javascript unit testing, yes we can e big
Javascript unit testing, yes we can   e bigJavascript unit testing, yes we can   e big
Javascript unit testing, yes we can e big
 
Test strategy for web development
Test strategy for web developmentTest strategy for web development
Test strategy for web development
 
JavaScript Unit Testing
JavaScript Unit TestingJavaScript Unit Testing
JavaScript Unit Testing
 
Javascript ui for rest services
Javascript ui for rest servicesJavascript ui for rest services
Javascript ui for rest services
 
Using of TDD practices for Magento
Using of TDD practices for MagentoUsing of TDD practices for Magento
Using of TDD practices for Magento
 
Gems Of Selenium
Gems Of SeleniumGems Of Selenium
Gems Of Selenium
 
Automated javascript unit testing
Automated javascript unit testingAutomated javascript unit testing
Automated javascript unit testing
 
Protractor framework architecture with example
Protractor framework architecture with exampleProtractor framework architecture with example
Protractor framework architecture with example
 
Easy tests with Selenide and Easyb
Easy tests with Selenide and EasybEasy tests with Selenide and Easyb
Easy tests with Selenide and Easyb
 
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
 
Understanding JavaScript Testing
Understanding JavaScript TestingUnderstanding JavaScript Testing
Understanding JavaScript Testing
 
Thomas Fuchs Presentation
Thomas Fuchs PresentationThomas Fuchs Presentation
Thomas Fuchs Presentation
 
Joomla! Testing - J!DD Germany 2016
Joomla! Testing - J!DD Germany 2016Joomla! Testing - J!DD Germany 2016
Joomla! Testing - J!DD Germany 2016
 
Testing your application on Google App Engine
Testing your application on Google App EngineTesting your application on Google App Engine
Testing your application on Google App Engine
 
Testing Your Application On Google App Engine
Testing Your Application On Google App EngineTesting Your Application On Google App Engine
Testing Your Application On Google App Engine
 
Webtests Reloaded - Webtest with Selenium, TestNG, Groovy and Maven
Webtests Reloaded - Webtest with Selenium, TestNG, Groovy and MavenWebtests Reloaded - Webtest with Selenium, TestNG, Groovy and Maven
Webtests Reloaded - Webtest with Selenium, TestNG, Groovy and Maven
 
Junit_.pptx
Junit_.pptxJunit_.pptx
Junit_.pptx
 
Javascript tdd byandreapaciolla
Javascript tdd byandreapaciollaJavascript tdd byandreapaciolla
Javascript tdd byandreapaciolla
 
Compatibility Detector Tool of Chrome extensions
Compatibility Detector Tool of Chrome extensionsCompatibility Detector Tool of Chrome extensions
Compatibility Detector Tool of Chrome extensions
 
A few good JavaScript development tools
A few good JavaScript development toolsA few good JavaScript development tools
A few good JavaScript development tools
 

Recently uploaded

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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

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...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
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
 
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
 
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...
 
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)
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.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
 
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 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...
 
"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 ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

Jasmine with JS-Test-Driver

  • 1. Problem Statement / Target Ability to run JavaScript tests through commandline (not exactly headlessly) Integrate test results with the Bamboo build plan Visibility of code-coverage
  • 2. Options for JS test-runner tools Env.js and Rhino.js V8 JavaScript Engine Jasmine-Maven plug-in Jasmine-Ruby plug-in Jasmine-JsTestDriver
  • 3. Env.js & Rhino.js Uses its own JS engine Is more closer to Mozilla Firefox Still does not even behave as a mirror image of Firefox, on commandline Findings: behaves as a different browser in itself V8 JavaScript Engine Google's open source JavaScript engine, used in chrome Is a C++ code-base, needs to be compiled on local machine Pretty capable, supports Mozilla and chrome, not sure about Safari Findings: Pretty capable, but have not explored much
  • 4. Jasmine-Maven Plug-in Uses HTMLUnit for headless browser runner HTMLUnit’s only supports Firefox and IE Findings – not capable to mock Safari capabilities Jasmine-Ruby Plug-in Has major issues with the “afterEach” and “toContains” Jasmine capabilities Can run with any browser – need to open the SpecRunner.html on the browser of choice !!! Findings – Promising, but needs to evolve
  • 6. Why JsTestDriver Can run JS tests through commandline, on the browser(ant version) of choice Generates output in JUnit format, making it easier for Bamboo integration Well compatible with Jasmine Possesses code-coverage capability Had certain minor issues, which have a workaround now
  • 7. Workarounds required for JTD Not fully compatible with prototype.js – required jar fix Jasmine spy issue, was unable to remove the spies – required Jasmine-JsTestDriver Adapter fix Never closes the browser tab when test-runner completes – added a minor apple-script fix
  • 8. Testing with JTD jsTestDriver configuration server: http://localhost:9876 load: - "tools/jasmine-test-driver/jasmine-1.0.1.js" - "tools/jasmine-test-driver/JasmineAdapter.js" - "tools/jasmine-test-driver/prototype-1.6.0.3.js" - "dist/qowt-browser-unitTests.js" rake test java -Xms512m -Xmx1024m -jar tools/jasmine-test-driver/JsTestDriver-1.2.2.jar --reset --port 9876 --runnerMode DEBUG --browser open --tests all --testOutput tests/test-reports
  • 9. Creating test-append-area QOWT.TEST.UTILS = function() { return { /** * creates dummy Test Append Area, and appends it to the document object, for running tests headlessly * While executing tests on Sumulat, you get "testAppendArea" div present in the html body itself. * But, in case of jsTestDriver, you do not have any such div present, and will have to create it on the fly. * @return testAppendArea div */ createTestAppendArea: function() { vartestAppendAreaContainer = document.getElementById('testAppendArea'); if(testAppendAreaContainer === null) { testAppendAreaContainer = document.createElement("div"); testAppendAreaContainer.innerHTML = '<div id="testAppendArea"></div>'; document.body.insert(testAppendAreaContainer); } return document.getElementById('testAppendArea'); } }; }(); USAGE: (CommonContentMrg-test.js) testAppendArea = QOWT.TEST.UTILS.createTestAppendArea(); testAppendArea.appendChild(rootNode);
  • 10. Code-Coverage with JTD rake coverage http://quicknet/display/PROD/Generating+Code+Coverage+Reports Coverage configurations server: http://localhost:9876 load: - "../jasmine-1.0.1.js" - "../JasmineAdapter.js" - "../prototype-1.6.0.3.js" - "../../../dist/qowt-browser-doc-sheet.js" - "../../../dist/qowt-browser-point.js" - "../../../dist/qowt-browser-testsOnly.js" plugin: - name: "coverage" jar: "tools/jasmine-test-driver/plugins/coverage-1.2.2.jar" module: "com.google.jstestdriver.coverage.CoverageModule"
  • 11. Debugging on JTD Start the server - java -Xms512m -Xmx1024m -jar tools/jasmine-test-driver/JsTestDriver-1.2.2.jar --port 9876 Open the browser with the url- http://localhost:9876/capture Run the tests - java -Xms512m -Xmx1024m -jar tools/jasmine-test-driver/JsTestDriver-1.2.2.jar --tests all Apply the breakpoint Run the tests again
  • 12. Known issue with JTD The rake script fails to close Safari window, if it has the developer console opened !!!