SlideShare a Scribd company logo
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 versions
Anirban Sen Chowdhary
 
Installing mule
Installing muleInstalling mule
Installing mule
JavierMarRas
 
Cache for community edition
Cache for community editionCache for community edition
Cache for community edition
irfan1008
 
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
Gennaro Spagnoli
 
How to setup jenkins
How to setup jenkinsHow to setup jenkins
How to setup jenkins
linuxdady
 
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
VEXXHOST Private Cloud
 
Simple Java component in Mule
Simple Java component in MuleSimple Java component in Mule
Simple Java component in Mule
Christian Hipolito
 
Intro to the Express Web Framework
Intro to the Express Web FrameworkIntro to the Express Web Framework
Intro to the Express Web Framework
jasonsich
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
irfan1008
 
Groovy with Mule
Groovy with MuleGroovy with Mule
Groovy with Mule
irfan1008
 
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
Gennaro 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 minutes
Gennaro Spagnoli
 
Groovy in Mule
Groovy in MuleGroovy in Mule
Groovy in Mule
Praneethchampion
 
Subversive install on Eclipse
Subversive install on EclipseSubversive install on Eclipse
Subversive install on Eclipse
Marcello Missiroli
 
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
Ganesh Bhosale
 
Deploying and Running in Mule
Deploying and Running in MuleDeploying and Running in Mule
Deploying and Running in Mule
Khasim Saheb
 
Install jenkins and sonar qube integration
Install jenkins and sonar qube integrationInstall jenkins and sonar qube integration
Install jenkins and sonar qube integration
Ankit Kumar
 
Mule velocity
Mule velocityMule velocity
Mule velocity
Praneethchampion
 
.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
Immo 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 v2
Paul Mulzoff
 
Gb Fundraising Group And Individual
Gb Fundraising Group And IndividualGb Fundraising Group And Individual
Gb Fundraising Group And Individual
UNCC Global Architecture Brigade
 
Print, Pixels & People 2009
Print, Pixels & People 2009Print, Pixels & People 2009
Print, Pixels & People 2009
Logan Aimone
 
Wacana minda 30julai
Wacana minda 30julaiWacana minda 30julai
Wacana minda 30julai
pjah85
 
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 Distribution
Peter 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 11a
Logan Aimone
 
7 C3 J
7 C3 J7 C3 J
7 C3 J
guest0af92fb
 
Spectra from Correlation
Spectra from CorrelationSpectra from Correlation
Spectra from Correlation
Peter Morovic
 
3 contabilidad
3  contabilidad3  contabilidad
3 contabilidad
cialcaca
 
The human heart
The human heartThe human heart
The human heart
Zeeta
 
Natural Color Profile Adjustment for Professionals
Natural Color Profile Adjustment for ProfessionalsNatural Color Profile Adjustment for Professionals
Natural Color Profile Adjustment for Professionals
Peter Morovic
 
Sources Of Energy(Sideshow)
Sources Of Energy(Sideshow)Sources Of Energy(Sideshow)
Sources Of Energy(Sideshow)
andreataylornatalie
 
Valores de la persona
Valores de la personaValores de la persona
Valores de la persona
Alberto Celarie
 
Brochure Accessweb
Brochure AccesswebBrochure Accessweb
Brochure Accessweb
AccessGroup Srl
 
The ACP Pacemaker Fall 2012
The ACP Pacemaker Fall 2012The ACP Pacemaker Fall 2012
The ACP Pacemaker Fall 2012
Logan Aimone
 
Technews August 2011 Volume 4
Technews August 2011 Volume 4Technews August 2011 Volume 4
Technews August 2011 Volume 4
Infiniti of Naperville
 

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 testing
Mats 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 testing
Sarah Elson
 
Java script basics
Java script basicsJava script basics
Java script basics
John Smith
 
Kickstarting Node.js Projects with Yeoman
Kickstarting Node.js Projects with YeomanKickstarting Node.js Projects with Yeoman
Kickstarting Node.js Projects with Yeoman
Patrick Buergin
 
Js unit testing
Js unit testingJs unit testing
Js unit testing
Mihail Irintchev
 
Agile JavaScript Testing
Agile JavaScript TestingAgile JavaScript Testing
Agile JavaScript Testing
Scott 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 project
ssuser29f27f
 
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
curwenmichaela
 
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
hartrobert670
 
Bridging the communication Gap & Continuous Delivery
Bridging the communication Gap & Continuous DeliveryBridging the communication Gap & Continuous Delivery
Bridging the communication Gap & Continuous Delivery
masoodjan
 
AI Builder - Text Classification
AI Builder - Text ClassificationAI Builder - Text Classification
AI Builder - Text Classification
Cheah Eng Soon
 
Thinkful - Intro to JavaScript
Thinkful - Intro to JavaScriptThinkful - Intro to JavaScript
Thinkful - Intro to JavaScript
TJ 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 Jasmine
PeterKha2
 
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 Design
Spy Seat
 
Testing Web Applications
Testing Web ApplicationsTesting Web Applications
Testing Web Applications
Seth McLaughlin
 
Java interview questions and answers
Java interview questions and answersJava interview questions and answers
Java interview questions and answers
Krishnaov
 
Automation Zaman Now
Automation Zaman NowAutomation Zaman Now
Automation Zaman Now
Ibnu Fajar Yunardi
 
JavaScript
JavaScriptJavaScript
JavaScript
Ivano Malavolta
 

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

DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 

Recently uploaded (20)

DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 

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.