SlideShare a Scribd company logo
1 of 18
Download to read offline
Up & Running with Jasmine
unit testing JavaScript
Md. Kamarul Kawnayeen
Preface
I’m assuming that you write your test code first, before writing your production
code. And when we are talking about a language like JavaScript, we have no
way to ignore unit testing. It has no static typing, no way to make a specific
variable or method private, so many different vendor (like chrome, safari, firefox
etc). If something went wrong, we just don’t know what went wrong.
Here I’ll show how to up & running with Jasmine for testing your JavaScript
code.
go here & download
WebStorm
After installing, run WebStorm & select “Create New Project”
Select “Empty Project” and then select the location & hit “Create”
here we are with a blank
project
go here & download the
latest standalone version
Unzip it, then copy the lib directory & SpecRunner.html
Now go to your WebStorm project, right click on the
project name & Paste
select ok & those files and folder will be in our project
open Specrunner.html & remove
the source & spec files
create a new directory scripts and within that directory
create two new js file, math.js & math-spec.js
math.js is our source file & math-spec.js is our spec file
As we are good developers :) , so we should write our test
code first. Open math-spec.js & write this simple test code.
describe(string, callback_function) and it(string,
callback_function) are two functions of Jasmine framework.
check details about them here.
Open the SpecRunner.html & add the new source
and spec file
Now right click on SpecRunner.html & select
Run “SpecRunner.html”
Well, we ran our unit test & it fails. Don’t worry, we didn’t write our production
code yet!!!
Open math.js & implement the sum function
Run SpecRunner.html again & yeah!! we pass this
time.

More Related Content

What's hot

Getting anypoint studios all versions
Getting anypoint studios all versionsGetting anypoint studios all versions
Getting anypoint studios all versionsAnirban Sen Chowdhary
 
Cache for community edition
Cache for community editionCache for community edition
Cache for community editionirfan1008
 
Mule esb How to convert from Json to Xml in 5 minutes
Mule esb How to convert from Json to Xml in 5 minutesMule esb How to convert from Json to Xml in 5 minutes
Mule esb How to convert from Json to Xml in 5 minutesGennaro Spagnoli
 
How to setup jenkins
How to setup jenkinsHow to setup jenkins
How to setup jenkinslinuxdady
 
How To Deploy a Clojure Web Application on Ubuntu 14.04
How To Deploy a Clojure Web Application on Ubuntu 14.04How To Deploy a Clojure Web Application on Ubuntu 14.04
How To Deploy a Clojure Web Application on Ubuntu 14.04VEXXHOST Private Cloud
 
Intro to the Express Web Framework
Intro to the Express Web FrameworkIntro to the Express Web Framework
Intro to the Express Web Frameworkjasonsich
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed storeirfan1008
 
Groovy with Mule
Groovy with MuleGroovy with Mule
Groovy with Muleirfan1008
 
Mule esb - How to use Idempotent Filters in 5 minutes
Mule esb - How to use Idempotent Filters in 5 minutesMule esb - How to use Idempotent Filters in 5 minutes
Mule esb - How to use Idempotent Filters in 5 minutesGennaro Spagnoli
 
Mule esb - How to connect to a MySql Database in 5 minutes
Mule esb - How to connect to a MySql Database in 5 minutesMule esb - How to connect to a MySql Database in 5 minutes
Mule esb - How to connect to a MySql Database in 5 minutesGennaro Spagnoli
 
Module 1 introduction to aws demo 4
Module 1 introduction to aws demo 4Module 1 introduction to aws demo 4
Module 1 introduction to aws demo 4Ganesh Bhosale
 
Deploying and Running in Mule
Deploying and Running in MuleDeploying and Running in Mule
Deploying and Running in MuleKhasim Saheb
 
Install jenkins and sonar qube integration
Install jenkins and sonar qube integrationInstall jenkins and sonar qube integration
Install jenkins and sonar qube integrationAnkit Kumar
 
.NET Conf 2018: Build Great Libraries using .NET Standard
.NET Conf 2018: Build Great Libraries using .NET Standard.NET Conf 2018: Build Great Libraries using .NET Standard
.NET Conf 2018: Build Great Libraries using .NET StandardImmo Landwerth
 

What's hot (19)

Getting anypoint studios all versions
Getting anypoint studios all versionsGetting anypoint studios all versions
Getting anypoint studios all versions
 
Installing mule
Installing muleInstalling mule
Installing mule
 
Cache for community edition
Cache for community editionCache for community edition
Cache for community edition
 
Mule esb How to convert from Json to Xml in 5 minutes
Mule esb How to convert from Json to Xml in 5 minutesMule esb How to convert from Json to Xml in 5 minutes
Mule esb How to convert from Json to Xml in 5 minutes
 
How to setup jenkins
How to setup jenkinsHow to setup jenkins
How to setup jenkins
 
How To Deploy a Clojure Web Application on Ubuntu 14.04
How To Deploy a Clojure Web Application on Ubuntu 14.04How To Deploy a Clojure Web Application on Ubuntu 14.04
How To Deploy a Clojure Web Application on Ubuntu 14.04
 
Simple Java component in Mule
Simple Java component in MuleSimple Java component in Mule
Simple Java component in Mule
 
Intro to the Express Web Framework
Intro to the Express Web FrameworkIntro to the Express Web Framework
Intro to the Express Web Framework
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
 
Groovy with Mule
Groovy with MuleGroovy with Mule
Groovy with Mule
 
Mule esb - How to use Idempotent Filters in 5 minutes
Mule esb - How to use Idempotent Filters in 5 minutesMule esb - How to use Idempotent Filters in 5 minutes
Mule esb - How to use Idempotent Filters in 5 minutes
 
Mule esb - How to connect to a MySql Database in 5 minutes
Mule esb - How to connect to a MySql Database in 5 minutesMule esb - How to connect to a MySql Database in 5 minutes
Mule esb - How to connect to a MySql Database in 5 minutes
 
Groovy in Mule
Groovy in MuleGroovy in Mule
Groovy in Mule
 
Subversive install on Eclipse
Subversive install on EclipseSubversive install on Eclipse
Subversive install on Eclipse
 
Module 1 introduction to aws demo 4
Module 1 introduction to aws demo 4Module 1 introduction to aws demo 4
Module 1 introduction to aws demo 4
 
Deploying and Running in Mule
Deploying and Running in MuleDeploying and Running in Mule
Deploying and Running in Mule
 
Install jenkins and sonar qube integration
Install jenkins and sonar qube integrationInstall jenkins and sonar qube integration
Install jenkins and sonar qube integration
 
Mule velocity
Mule velocityMule velocity
Mule velocity
 
.NET Conf 2018: Build Great Libraries using .NET Standard
.NET Conf 2018: Build Great Libraries using .NET Standard.NET Conf 2018: Build Great Libraries using .NET Standard
.NET Conf 2018: Build Great Libraries using .NET Standard
 

Viewers also liked

Online strategy and analytics v2
Online strategy and analytics v2Online strategy and analytics v2
Online strategy and analytics v2Paul Mulzoff
 
Print, Pixels & People 2009
Print, Pixels & People 2009Print, Pixels & People 2009
Print, Pixels & People 2009Logan Aimone
 
Wacana minda 30julai
Wacana minda 30julaiWacana minda 30julai
Wacana minda 30julaipjah85
 
Inserció Laboral dels Ensenyaments Professionals 2010
Inserció Laboral dels Ensenyaments Professionals 2010Inserció Laboral dels Ensenyaments Professionals 2010
Inserció Laboral dels Ensenyaments Professionals 2010tribunavirtual
 
Den Globale Landsbyen
Den Globale LandsbyenDen Globale Landsbyen
Den Globale Landsbyenketil vigdal
 
Color Scrambling for Secure Digital Content Distribution
Color Scrambling for Secure Digital Content DistributionColor Scrambling for Secure Digital Content Distribution
Color Scrambling for Secure Digital Content DistributionPeter Morovic
 
Twitter Guide(트위터 가이드) ver2 Charistics & Practical Use(특징과 활용)
Twitter Guide(트위터 가이드) ver2 Charistics & Practical Use(특징과 활용)Twitter Guide(트위터 가이드) ver2 Charistics & Practical Use(특징과 활용)
Twitter Guide(트위터 가이드) ver2 Charistics & Practical Use(특징과 활용)Jae-min Sung
 
The Pacemaker NSPA 11a
The Pacemaker NSPA 11aThe Pacemaker NSPA 11a
The Pacemaker NSPA 11aLogan Aimone
 
Spectra from Correlation
Spectra from CorrelationSpectra from Correlation
Spectra from CorrelationPeter Morovic
 
3 contabilidad
3  contabilidad3  contabilidad
3 contabilidadcialcaca
 
The human heart
The human heartThe human heart
The human heartZeeta
 
Natural Color Profile Adjustment for Professionals
Natural Color Profile Adjustment for ProfessionalsNatural Color Profile Adjustment for Professionals
Natural Color Profile Adjustment for ProfessionalsPeter Morovic
 
The ACP Pacemaker Fall 2012
The ACP Pacemaker Fall 2012The ACP Pacemaker Fall 2012
The ACP Pacemaker Fall 2012Logan Aimone
 

Viewers also liked (20)

Online strategy and analytics v2
Online strategy and analytics v2Online strategy and analytics v2
Online strategy and analytics v2
 
Gb Fundraising Group And Individual
Gb Fundraising Group And IndividualGb Fundraising Group And Individual
Gb Fundraising Group And Individual
 
Print, Pixels & People 2009
Print, Pixels & People 2009Print, Pixels & People 2009
Print, Pixels & People 2009
 
Ubeon partena, bedrijfspresentatie slideshare
Ubeon partena, bedrijfspresentatie slideshareUbeon partena, bedrijfspresentatie slideshare
Ubeon partena, bedrijfspresentatie slideshare
 
Wacana minda 30julai
Wacana minda 30julaiWacana minda 30julai
Wacana minda 30julai
 
Inserció Laboral dels Ensenyaments Professionals 2010
Inserció Laboral dels Ensenyaments Professionals 2010Inserció Laboral dels Ensenyaments Professionals 2010
Inserció Laboral dels Ensenyaments Professionals 2010
 
Den Globale Landsbyen
Den Globale LandsbyenDen Globale Landsbyen
Den Globale Landsbyen
 
Color Scrambling for Secure Digital Content Distribution
Color Scrambling for Secure Digital Content DistributionColor Scrambling for Secure Digital Content Distribution
Color Scrambling for Secure Digital Content Distribution
 
Twitter Guide(트위터 가이드) ver2 Charistics & Practical Use(특징과 활용)
Twitter Guide(트위터 가이드) ver2 Charistics & Practical Use(특징과 활용)Twitter Guide(트위터 가이드) ver2 Charistics & Practical Use(특징과 활용)
Twitter Guide(트위터 가이드) ver2 Charistics & Practical Use(특징과 활용)
 
The Pacemaker NSPA 11a
The Pacemaker NSPA 11aThe Pacemaker NSPA 11a
The Pacemaker NSPA 11a
 
7 C3 J
7 C3 J7 C3 J
7 C3 J
 
Spectra from Correlation
Spectra from CorrelationSpectra from Correlation
Spectra from Correlation
 
3 contabilidad
3  contabilidad3  contabilidad
3 contabilidad
 
The human heart
The human heartThe human heart
The human heart
 
Natural Color Profile Adjustment for Professionals
Natural Color Profile Adjustment for ProfessionalsNatural Color Profile Adjustment for Professionals
Natural Color Profile Adjustment for Professionals
 
Sources Of Energy(Sideshow)
Sources Of Energy(Sideshow)Sources Of Energy(Sideshow)
Sources Of Energy(Sideshow)
 
Valores de la persona
Valores de la personaValores de la persona
Valores de la persona
 
Brochure Accessweb
Brochure AccesswebBrochure Accessweb
Brochure Accessweb
 
The ACP Pacemaker Fall 2012
The ACP Pacemaker Fall 2012The ACP Pacemaker Fall 2012
The ACP Pacemaker Fall 2012
 
Technews August 2011 Volume 4
Technews August 2011 Volume 4Technews August 2011 Volume 4
Technews August 2011 Volume 4
 

Similar to Up & running with jasmine

Java script unit testing
Java script unit testingJava script unit testing
Java script unit testingMats Bryntse
 
Using galen framework for automated cross browser layout testing
Using galen framework for automated cross browser layout testingUsing galen framework for automated cross browser layout testing
Using galen framework for automated cross browser layout testingSarah Elson
 
Java script basics
Java script basicsJava script basics
Java script basicsJohn Smith
 
Kickstarting Node.js Projects with Yeoman
Kickstarting Node.js Projects with YeomanKickstarting Node.js Projects with Yeoman
Kickstarting Node.js Projects with YeomanPatrick Buergin
 
Agile JavaScript Testing
Agile JavaScript TestingAgile JavaScript Testing
Agile JavaScript TestingScott Becker
 
Tutorial how to create a simple maven project
Tutorial how to create a simple maven projectTutorial how to create a simple maven project
Tutorial how to create a simple maven projectssuser29f27f
 
Broncosbuild.xmlBuilds, tests, and runs the project Broncos..docx
Broncosbuild.xmlBuilds, tests, and runs the project Broncos..docxBroncosbuild.xmlBuilds, tests, and runs the project Broncos..docx
Broncosbuild.xmlBuilds, tests, and runs the project Broncos..docxcurwenmichaela
 
Broncosbuild.xmlBuilds, tests, and runs the project Broncos..docx
Broncosbuild.xmlBuilds, tests, and runs the project Broncos..docxBroncosbuild.xmlBuilds, tests, and runs the project Broncos..docx
Broncosbuild.xmlBuilds, tests, and runs the project Broncos..docxhartrobert670
 
Bridging the communication Gap & Continuous Delivery
Bridging the communication Gap & Continuous DeliveryBridging the communication Gap & Continuous Delivery
Bridging the communication Gap & Continuous Deliverymasoodjan
 
AI Builder - Text Classification
AI Builder - Text ClassificationAI Builder - Text Classification
AI Builder - Text ClassificationCheah Eng Soon
 
Thinkful - Intro to JavaScript
Thinkful - Intro to JavaScriptThinkful - Intro to JavaScript
Thinkful - Intro to JavaScriptTJ Stalcup
 
Intro to javascript (6:27)
Intro to javascript (6:27)Intro to javascript (6:27)
Intro to javascript (6:27)David Coulter
 
TDD Setup With Jasmine
TDD Setup With JasmineTDD Setup With Jasmine
TDD Setup With JasminePeterKha2
 
Intro to javascript (6:19)
Intro to javascript (6:19)Intro to javascript (6:19)
Intro to javascript (6:19)Thinkful
 
Software Design
Software DesignSoftware Design
Software DesignSpy Seat
 
Testing Web Applications
Testing Web ApplicationsTesting Web Applications
Testing Web ApplicationsSeth McLaughlin
 
Java interview questions and answers
Java interview questions and answersJava interview questions and answers
Java interview questions and answersKrishnaov
 

Similar to Up & running with jasmine (20)

Java script unit testing
Java script unit testingJava script unit testing
Java script unit testing
 
Using galen framework for automated cross browser layout testing
Using galen framework for automated cross browser layout testingUsing galen framework for automated cross browser layout testing
Using galen framework for automated cross browser layout testing
 
Java script basics
Java script basicsJava script basics
Java script basics
 
Kickstarting Node.js Projects with Yeoman
Kickstarting Node.js Projects with YeomanKickstarting Node.js Projects with Yeoman
Kickstarting Node.js Projects with Yeoman
 
Js unit testing
Js unit testingJs unit testing
Js unit testing
 
Agile JavaScript Testing
Agile JavaScript TestingAgile JavaScript Testing
Agile JavaScript Testing
 
Tutorial how to create a simple maven project
Tutorial how to create a simple maven projectTutorial how to create a simple maven project
Tutorial how to create a simple maven project
 
Broncosbuild.xmlBuilds, tests, and runs the project Broncos..docx
Broncosbuild.xmlBuilds, tests, and runs the project Broncos..docxBroncosbuild.xmlBuilds, tests, and runs the project Broncos..docx
Broncosbuild.xmlBuilds, tests, and runs the project Broncos..docx
 
Broncosbuild.xmlBuilds, tests, and runs the project Broncos..docx
Broncosbuild.xmlBuilds, tests, and runs the project Broncos..docxBroncosbuild.xmlBuilds, tests, and runs the project Broncos..docx
Broncosbuild.xmlBuilds, tests, and runs the project Broncos..docx
 
Bridging the communication Gap & Continuous Delivery
Bridging the communication Gap & Continuous DeliveryBridging the communication Gap & Continuous Delivery
Bridging the communication Gap & Continuous Delivery
 
AI Builder - Text Classification
AI Builder - Text ClassificationAI Builder - Text Classification
AI Builder - Text Classification
 
Thinkful - Intro to JavaScript
Thinkful - Intro to JavaScriptThinkful - Intro to JavaScript
Thinkful - Intro to JavaScript
 
Intro to javascript (6:27)
Intro to javascript (6:27)Intro to javascript (6:27)
Intro to javascript (6:27)
 
TDD Setup With Jasmine
TDD Setup With JasmineTDD Setup With Jasmine
TDD Setup With Jasmine
 
Intro to javascript (6:19)
Intro to javascript (6:19)Intro to javascript (6:19)
Intro to javascript (6:19)
 
Software Design
Software DesignSoftware Design
Software Design
 
Testing Web Applications
Testing Web ApplicationsTesting Web Applications
Testing Web Applications
 
Java interview questions and answers
Java interview questions and answersJava interview questions and answers
Java interview questions and answers
 
Automation Zaman Now
Automation Zaman NowAutomation Zaman Now
Automation Zaman Now
 
JavaScript
JavaScriptJavaScript
JavaScript
 

Recently uploaded

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 

Recently uploaded (20)

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 

Up & running with jasmine

  • 1. Up & Running with Jasmine unit testing JavaScript Md. Kamarul Kawnayeen
  • 2. Preface I’m assuming that you write your test code first, before writing your production code. And when we are talking about a language like JavaScript, we have no way to ignore unit testing. It has no static typing, no way to make a specific variable or method private, so many different vendor (like chrome, safari, firefox etc). If something went wrong, we just don’t know what went wrong. Here I’ll show how to up & running with Jasmine for testing your JavaScript code.
  • 3. go here & download WebStorm
  • 4. After installing, run WebStorm & select “Create New Project”
  • 5. Select “Empty Project” and then select the location & hit “Create”
  • 6. here we are with a blank project
  • 7. go here & download the latest standalone version
  • 8. Unzip it, then copy the lib directory & SpecRunner.html
  • 9. Now go to your WebStorm project, right click on the project name & Paste
  • 10. select ok & those files and folder will be in our project
  • 11. open Specrunner.html & remove the source & spec files
  • 12. create a new directory scripts and within that directory create two new js file, math.js & math-spec.js math.js is our source file & math-spec.js is our spec file
  • 13. As we are good developers :) , so we should write our test code first. Open math-spec.js & write this simple test code. describe(string, callback_function) and it(string, callback_function) are two functions of Jasmine framework. check details about them here.
  • 14. Open the SpecRunner.html & add the new source and spec file
  • 15. Now right click on SpecRunner.html & select Run “SpecRunner.html”
  • 16. Well, we ran our unit test & it fails. Don’t worry, we didn’t write our production code yet!!!
  • 17. Open math.js & implement the sum function
  • 18. Run SpecRunner.html again & yeah!! we pass this time.