SlideShare a Scribd company logo
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

Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 

Recently uploaded (20)

JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
НАДІЯ ФЕДЮШКО БАЦ «Професійне зростання QA спеціаліста»
НАДІЯ ФЕДЮШКО БАЦ  «Професійне зростання QA спеціаліста»НАДІЯ ФЕДЮШКО БАЦ  «Професійне зростання QA спеціаліста»
НАДІЯ ФЕДЮШКО БАЦ «Професійне зростання QA спеціаліста»
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
КАТЕРИНА АБЗЯТОВА «Ефективне планування тестування ключові аспекти та практ...
КАТЕРИНА АБЗЯТОВА  «Ефективне планування тестування  ключові аспекти та практ...КАТЕРИНА АБЗЯТОВА  «Ефективне планування тестування  ключові аспекти та практ...
КАТЕРИНА АБЗЯТОВА «Ефективне планування тестування ключові аспекти та практ...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Ransomware Mallox [EN].pdf
Ransomware         Mallox       [EN].pdfRansomware         Mallox       [EN].pdf
Ransomware Mallox [EN].pdf
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 

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 !!!