SlideShare una empresa de Scribd logo
1 de 16
CONFIGURE JASMINE AND KARMA
NODE.JS
WHY KARMA?
 A simple tool that allows you to execute JavaScript code in multiple real browsers
 Karma is to make your test-driven development easy, fast, and fun
 Test code in multiple browsers (desktop, mobile, tablets, etc.)
 Execute your tests locally during development
 Execute your tests on a continuous integration server
 Execute your tests on every save
 Uses Istanbul to automagically generate coverage reports
WHY TESTING FRAMEWORK NEEDED?
 Karma is not a testing framework, nor an assertion library
 Karma just launches an HTTP server, and generates the test runner HTML file
 Available Javascript Testing framework plugin
 Jasmine
 Mocha
 Qunit
PRE-REQUISITE - INSTALL NODE.JS AND NPM
 Open - https://nodejs.org/en/download/ and select appropriate operating system (Windows for demo)
 It starts downloading the exe file, open it once it finishes downloading
 Complete the installation wizard and verify the installation
CREATE NEW NODE PROJECT
 Command –
 npm init
 It creates new node project
along with package.json file
INSTALL KARMA
 Command –
 npm install karma –save-dev
 npm install requirejs --save-dev
 npm install karma-requirejs --save-dev
 It adds new karma and require dev dependency in package.json
INSTALL JASMINE AND KARMA CHROME LAUNCHER
 Command –
 npm install jasmine-core karma karma-chrome-launcher --save-dev
 npm install karma-jasmine karma-jasmine-html-reporter karma-spec-reporter --save-dev
 It adds new dependencies in package.json
CONFIGURE KARMA
 Command –
 npm install -g karma-cli
 karma init karma.conf.js
 It will install karma cli globally, new
dependencies in package.json
 Run Karma simply by “karma” from
anywhere and it will always run the local
version
 The configuration file can be generated
using karma init
DEPENDENCIES IN PACKAGE.JSON
KARMA.CONF.JS
RUN KARMA
 Command –
 karma start karma.conf.js
 Run Karma simply by “karma” from
anywhere and it will always run the local
version
FILE STRUCTURE
Spec Folder –
It contains all the test file
Src Folder –
It contains all the source
files
package.json file –
file in the app root defines
what libraries will be
installed into
node_modules when you
run npm install
Node Modules –
Directory is only for build tools
Karma.conf –
It contains Karma related
configuration
package-lock.json–
automatically generated for
any operations where npm
modifies either the
node_modules tree
SAMPLE SRC FILE AND SPEC FILE
KARMA RESULTS
CODE COVERAGE RESULTS
THANK YOU

Más contenido relacionado

La actualidad más candente

Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with CapistranoRamazan K
 
Delivering a production Cloud Foundry Environment with Bosh | anynines
Delivering a production Cloud Foundry Environment with Bosh | anyninesDelivering a production Cloud Foundry Environment with Bosh | anynines
Delivering a production Cloud Foundry Environment with Bosh | anyninesanynines GmbH
 
Two Years, Zero servers: Lessons learned from running a startup 100% on Serve...
Two Years, Zero servers: Lessons learned from running a startup 100% on Serve...Two Years, Zero servers: Lessons learned from running a startup 100% on Serve...
Two Years, Zero servers: Lessons learned from running a startup 100% on Serve...Cloud Native Day Tel Aviv
 
WooCommerce WP-CLI Basics
WooCommerce WP-CLI BasicsWooCommerce WP-CLI Basics
WooCommerce WP-CLI Basicscorsonr
 
Word press workflows and gulp
Word press workflows and gulpWord press workflows and gulp
Word press workflows and gulpEli McMakin
 
Ordina SOFTC Presentation - Async CTP
Ordina SOFTC Presentation - Async CTPOrdina SOFTC Presentation - Async CTP
Ordina SOFTC Presentation - Async CTPOrdina Belgium
 
Cloud infrastructures - Slide Set 6 - BOSH | anynines
Cloud infrastructures - Slide Set 6 - BOSH | anyninesCloud infrastructures - Slide Set 6 - BOSH | anynines
Cloud infrastructures - Slide Set 6 - BOSH | anyninesanynines GmbH
 
How to install ReactJS software
How to install ReactJS software How to install ReactJS software
How to install ReactJS software VigneshVijay21
 
Docker Containers: Developer’s experience and building robust developer envir...
Docker Containers: Developer’s experience and building robust developer envir...Docker Containers: Developer’s experience and building robust developer envir...
Docker Containers: Developer’s experience and building robust developer envir...Future Cloud Summit
 
How to work with Selenium Grid and Cloud Solutions
How to work with Selenium Grid and Cloud SolutionsHow to work with Selenium Grid and Cloud Solutions
How to work with Selenium Grid and Cloud SolutionsNoam Zakai
 
Devops Boise - Israel Shirk - Pragmatic Migration to Infrastructure As Code
Devops Boise - Israel Shirk - Pragmatic Migration to Infrastructure As CodeDevops Boise - Israel Shirk - Pragmatic Migration to Infrastructure As Code
Devops Boise - Israel Shirk - Pragmatic Migration to Infrastructure As CodeIsrael Shirk
 
RedMart Migrating from EC2 to VPC with Chef
RedMart Migrating from EC2 to VPC with ChefRedMart Migrating from EC2 to VPC with Chef
RedMart Migrating from EC2 to VPC with ChefRitesh Angural
 
What's New in Docker 1.13?
What's New in Docker 1.13?What's New in Docker 1.13?
What's New in Docker 1.13?Michael Irwin
 
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)Simon Boulet
 
Capistrano, Puppet, and Chef
Capistrano, Puppet, and ChefCapistrano, Puppet, and Chef
Capistrano, Puppet, and ChefDavid Benjamin
 

La actualidad más candente (20)

Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with Capistrano
 
Delivering a production Cloud Foundry Environment with Bosh | anynines
Delivering a production Cloud Foundry Environment with Bosh | anyninesDelivering a production Cloud Foundry Environment with Bosh | anynines
Delivering a production Cloud Foundry Environment with Bosh | anynines
 
Frontend Build Tools - CC FE & UX
Frontend Build Tools - CC FE & UXFrontend Build Tools - CC FE & UX
Frontend Build Tools - CC FE & UX
 
Capistrano 3 Deployment
Capistrano 3 DeploymentCapistrano 3 Deployment
Capistrano 3 Deployment
 
Two Years, Zero servers: Lessons learned from running a startup 100% on Serve...
Two Years, Zero servers: Lessons learned from running a startup 100% on Serve...Two Years, Zero servers: Lessons learned from running a startup 100% on Serve...
Two Years, Zero servers: Lessons learned from running a startup 100% on Serve...
 
WooCommerce WP-CLI Basics
WooCommerce WP-CLI BasicsWooCommerce WP-CLI Basics
WooCommerce WP-CLI Basics
 
Word press workflows and gulp
Word press workflows and gulpWord press workflows and gulp
Word press workflows and gulp
 
Ordina SOFTC Presentation - Async CTP
Ordina SOFTC Presentation - Async CTPOrdina SOFTC Presentation - Async CTP
Ordina SOFTC Presentation - Async CTP
 
Cloud infrastructures - Slide Set 6 - BOSH | anynines
Cloud infrastructures - Slide Set 6 - BOSH | anyninesCloud infrastructures - Slide Set 6 - BOSH | anynines
Cloud infrastructures - Slide Set 6 - BOSH | anynines
 
How to install ReactJS software
How to install ReactJS software How to install ReactJS software
How to install ReactJS software
 
Docker Containers: Developer’s experience and building robust developer envir...
Docker Containers: Developer’s experience and building robust developer envir...Docker Containers: Developer’s experience and building robust developer envir...
Docker Containers: Developer’s experience and building robust developer envir...
 
How to work with Selenium Grid and Cloud Solutions
How to work with Selenium Grid and Cloud SolutionsHow to work with Selenium Grid and Cloud Solutions
How to work with Selenium Grid and Cloud Solutions
 
Capistrano
CapistranoCapistrano
Capistrano
 
Devops Boise - Israel Shirk - Pragmatic Migration to Infrastructure As Code
Devops Boise - Israel Shirk - Pragmatic Migration to Infrastructure As CodeDevops Boise - Israel Shirk - Pragmatic Migration to Infrastructure As Code
Devops Boise - Israel Shirk - Pragmatic Migration to Infrastructure As Code
 
RedMart Migrating from EC2 to VPC with Chef
RedMart Migrating from EC2 to VPC with ChefRedMart Migrating from EC2 to VPC with Chef
RedMart Migrating from EC2 to VPC with Chef
 
Perl ides
Perl idesPerl ides
Perl ides
 
What's New in Docker 1.13?
What's New in Docker 1.13?What's New in Docker 1.13?
What's New in Docker 1.13?
 
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
 
Capistrano, Puppet, and Chef
Capistrano, Puppet, and ChefCapistrano, Puppet, and Chef
Capistrano, Puppet, and Chef
 
Docker, OSS and Azure
Docker, OSS and AzureDocker, OSS and Azure
Docker, OSS and Azure
 

Similar a Configure jasmine and karma for code coverage

Workshop 3: JavaScript build tools
Workshop 3: JavaScript build toolsWorkshop 3: JavaScript build tools
Workshop 3: JavaScript build toolsVisual Engineering
 
Automation framework using selenium webdriver with java
Automation framework using selenium webdriver with javaAutomation framework using selenium webdriver with java
Automation framework using selenium webdriver with javaNarayanan Palani
 
Creating your own AtoM demo data set for re-use with Vagrant
Creating your own AtoM demo data set for re-use with VagrantCreating your own AtoM demo data set for re-use with Vagrant
Creating your own AtoM demo data set for re-use with VagrantArtefactual Systems - AtoM
 
Decapitating Selenium with JavaScript
Decapitating Selenium with JavaScriptDecapitating Selenium with JavaScript
Decapitating Selenium with JavaScriptAlan Parkinson
 
Pet Pen Testing Tools: Zenmap & Nmap
Pet Pen Testing Tools: Zenmap & NmapPet Pen Testing Tools: Zenmap & Nmap
Pet Pen Testing Tools: Zenmap & NmapMatt Vieyra
 
AngularJS Unit Test
AngularJS Unit TestAngularJS Unit Test
AngularJS Unit TestChiew Carol
 
Cpsc 473 01 lightning talk
Cpsc 473 01 lightning talkCpsc 473 01 lightning talk
Cpsc 473 01 lightning talkKetul Shah
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierCarlos Sanchez
 
Api webservice setupinstructions
Api webservice setupinstructionsApi webservice setupinstructions
Api webservice setupinstructionsShivaling Sannalli
 
macos installation automation
macos installation automationmacos installation automation
macos installation automationJon Fuller
 
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Carlos Sanchez
 
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...Carlos Sanchez
 
RAC-Installing your First Cluster and Database
RAC-Installing your First Cluster and DatabaseRAC-Installing your First Cluster and Database
RAC-Installing your First Cluster and DatabaseNikhil Kumar
 
Webinar: Creating an Effective Docker Build Pipeline for Java Apps
Webinar: Creating an Effective Docker Build Pipeline for Java AppsWebinar: Creating an Effective Docker Build Pipeline for Java Apps
Webinar: Creating an Effective Docker Build Pipeline for Java AppsCodefresh
 
PhoneGap Day 2016 EU: Creating the Ideal Cordova Dev Environment
PhoneGap Day 2016 EU: Creating the Ideal Cordova Dev EnvironmentPhoneGap Day 2016 EU: Creating the Ideal Cordova Dev Environment
PhoneGap Day 2016 EU: Creating the Ideal Cordova Dev EnvironmentRyan J. Salva
 
Protractor Testing Automation Tool Framework / Jasmine Reporters
Protractor Testing Automation Tool Framework / Jasmine ReportersProtractor Testing Automation Tool Framework / Jasmine Reporters
Protractor Testing Automation Tool Framework / Jasmine ReportersHaitham Refaat
 
An Introduction of Node Package Manager (NPM)
An Introduction of Node Package Manager (NPM)An Introduction of Node Package Manager (NPM)
An Introduction of Node Package Manager (NPM)iFour Technolab Pvt. Ltd.
 
Release with confidence
Release with confidenceRelease with confidence
Release with confidenceJohn Congdon
 

Similar a Configure jasmine and karma for code coverage (20)

Workshop 3: JavaScript build tools
Workshop 3: JavaScript build toolsWorkshop 3: JavaScript build tools
Workshop 3: JavaScript build tools
 
Angular2 ecosystem
Angular2 ecosystemAngular2 ecosystem
Angular2 ecosystem
 
NPM.pdf
NPM.pdfNPM.pdf
NPM.pdf
 
Automation framework using selenium webdriver with java
Automation framework using selenium webdriver with javaAutomation framework using selenium webdriver with java
Automation framework using selenium webdriver with java
 
Creating your own AtoM demo data set for re-use with Vagrant
Creating your own AtoM demo data set for re-use with VagrantCreating your own AtoM demo data set for re-use with Vagrant
Creating your own AtoM demo data set for re-use with Vagrant
 
Decapitating Selenium with JavaScript
Decapitating Selenium with JavaScriptDecapitating Selenium with JavaScript
Decapitating Selenium with JavaScript
 
Pet Pen Testing Tools: Zenmap & Nmap
Pet Pen Testing Tools: Zenmap & NmapPet Pen Testing Tools: Zenmap & Nmap
Pet Pen Testing Tools: Zenmap & Nmap
 
AngularJS Unit Test
AngularJS Unit TestAngularJS Unit Test
AngularJS Unit Test
 
Cpsc 473 01 lightning talk
Cpsc 473 01 lightning talkCpsc 473 01 lightning talk
Cpsc 473 01 lightning talk
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next Frontier
 
Api webservice setupinstructions
Api webservice setupinstructionsApi webservice setupinstructions
Api webservice setupinstructions
 
macos installation automation
macos installation automationmacos installation automation
macos installation automation
 
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
 
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
 
RAC-Installing your First Cluster and Database
RAC-Installing your First Cluster and DatabaseRAC-Installing your First Cluster and Database
RAC-Installing your First Cluster and Database
 
Webinar: Creating an Effective Docker Build Pipeline for Java Apps
Webinar: Creating an Effective Docker Build Pipeline for Java AppsWebinar: Creating an Effective Docker Build Pipeline for Java Apps
Webinar: Creating an Effective Docker Build Pipeline for Java Apps
 
PhoneGap Day 2016 EU: Creating the Ideal Cordova Dev Environment
PhoneGap Day 2016 EU: Creating the Ideal Cordova Dev EnvironmentPhoneGap Day 2016 EU: Creating the Ideal Cordova Dev Environment
PhoneGap Day 2016 EU: Creating the Ideal Cordova Dev Environment
 
Protractor Testing Automation Tool Framework / Jasmine Reporters
Protractor Testing Automation Tool Framework / Jasmine ReportersProtractor Testing Automation Tool Framework / Jasmine Reporters
Protractor Testing Automation Tool Framework / Jasmine Reporters
 
An Introduction of Node Package Manager (NPM)
An Introduction of Node Package Manager (NPM)An Introduction of Node Package Manager (NPM)
An Introduction of Node Package Manager (NPM)
 
Release with confidence
Release with confidenceRelease with confidence
Release with confidence
 

Último

Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 

Último (20)

Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 

Configure jasmine and karma for code coverage

  • 1. CONFIGURE JASMINE AND KARMA NODE.JS
  • 2. WHY KARMA?  A simple tool that allows you to execute JavaScript code in multiple real browsers  Karma is to make your test-driven development easy, fast, and fun  Test code in multiple browsers (desktop, mobile, tablets, etc.)  Execute your tests locally during development  Execute your tests on a continuous integration server  Execute your tests on every save  Uses Istanbul to automagically generate coverage reports
  • 3. WHY TESTING FRAMEWORK NEEDED?  Karma is not a testing framework, nor an assertion library  Karma just launches an HTTP server, and generates the test runner HTML file  Available Javascript Testing framework plugin  Jasmine  Mocha  Qunit
  • 4. PRE-REQUISITE - INSTALL NODE.JS AND NPM  Open - https://nodejs.org/en/download/ and select appropriate operating system (Windows for demo)  It starts downloading the exe file, open it once it finishes downloading  Complete the installation wizard and verify the installation
  • 5. CREATE NEW NODE PROJECT  Command –  npm init  It creates new node project along with package.json file
  • 6. INSTALL KARMA  Command –  npm install karma –save-dev  npm install requirejs --save-dev  npm install karma-requirejs --save-dev  It adds new karma and require dev dependency in package.json
  • 7. INSTALL JASMINE AND KARMA CHROME LAUNCHER  Command –  npm install jasmine-core karma karma-chrome-launcher --save-dev  npm install karma-jasmine karma-jasmine-html-reporter karma-spec-reporter --save-dev  It adds new dependencies in package.json
  • 8. CONFIGURE KARMA  Command –  npm install -g karma-cli  karma init karma.conf.js  It will install karma cli globally, new dependencies in package.json  Run Karma simply by “karma” from anywhere and it will always run the local version  The configuration file can be generated using karma init
  • 11. RUN KARMA  Command –  karma start karma.conf.js  Run Karma simply by “karma” from anywhere and it will always run the local version
  • 12. FILE STRUCTURE Spec Folder – It contains all the test file Src Folder – It contains all the source files package.json file – file in the app root defines what libraries will be installed into node_modules when you run npm install Node Modules – Directory is only for build tools Karma.conf – It contains Karma related configuration package-lock.json– automatically generated for any operations where npm modifies either the node_modules tree
  • 13. SAMPLE SRC FILE AND SPEC FILE