Unit Testing Node - Js PDF
Unit Testing Node - Js PDF
Unit Testing Node - Js PDF
Unit Testing in
Node.js
by <JS/>
17th March, 2019
LOVERS
Oriserve,
August 2018
About Me Classplus,
Fullstack Engineer September 2017
nc e
...working with JS si
2017 Kisan Network,
March, 2017
ashokdey_
Ashok Dey
Agenda
● SDLC
● Testing
C o d in g P has e & Unit Testing
●
Node.js
● Unit Testing in
evelopment
● Test Driven D
e
● Code Coverag
● CI/CD
Prerequisites
Well, you need to
have these to follo
w along:
● Code Editor
(like VSCode)
● Knowledge o
f Git
● Knowledge o
f JavaScript/Node
● Heroku Acco .js
unt
● GitHub Acco
unt
SDLC
lo p m e n t Life C ycle refers to
Software Deve and
s s es u s ed to p lan, create, test
proce
ation system
deploy an inform
re
r e n d in g lo o p used for Softwa
A neve
Development!
se
g Pha
d i n
Co
you, right?
It’s a loop. I told
Testing
g p h a s e in S D L C involves
Testin
end result
validation of the
u c t) is d o in g e v erything in
(prod d to do.
y it is s u pp o s e
the wa
Coding Phase
Where the happin
ess lies, our area o
f interest!
Co di n g Ph a s e
e n ti fy th e P ro blem - What Are
1. Id
Do?
You Trying To It
D e s ig n a S o lution - How Is
2.
one?
Going To Be D
ching
. W ri te th e Program - Tea
3
to it
the Computer
e c k th e S o lu ti on - Testing it
4. Ch
ou
Understands Y
Software Testing
Unit Testing
sti ng is a le ve l of software
Unit Te u a l units/
h e re in div id
testing w
p o n e n ts o f a s oftware are
com
tested.
When you
pr o p o s e U n it
Testing to
y o u r t e a m .. .
ti ng!
Let’s do Unit Tes
We w i l l d o in g :
ries
● Know the Libra
● Testing Setup
● Assertion
ons
● Testing Functi
cks
● Testing Callba
es
● Testing Promis
nit Tests
● Good vs. Bad U
Tools for Te
s ting
1. Mocha
2. Jest
3. Jasmine
4. Karma...
Typical set of
modules:
e
● Mocha/Tap
(Frameworks)
/Expect
● Chai/Tape
(Assertions)
● Sinon
(Mocks/Spies)
● Istanbul
(Coverage)
A testing Platform
, developed
by Facebook
Meet Jest
Let’s Cod
e
Clon e t h e r e p o
th in g is s e t up for you! :)
Every
URL:
Just got to this
GUNr6
https://bit.ly/2E
Code
Coverage!
enough Unit Tests?
Have you written
Github
Badges
They makes your
repo more appealin
g!
CI/CD??
u to
o n ti n u o u s In te gration helps yo
C !
te g ra te n ew fe atures on the go
in
iated
fe a tu re s a re a dded and assoc
Once the fu l, it gets deployed
re s u c c e s s
tests a is Continuous
a ti ca lly . T h is
autom
Deployment
Github
Hooks!
No no, they are n
ot similar to Reac
t.js hooks!!
Le t ’ s s ee t h e m
in action
That’s All :)
Was that all? No I
left few things….
F i n a l l y y o u r
Team
members...
Add me in your network:
linkedin.com/in/ashokdey
Thank You!
Follow me:
github.com/ashokdey
Unit testing
Follow me:
seriously twitter.com/@ashokdey_