KEMBAR78
DEV.BG - Angular 1 and Jasmine (Unit Testing and TDD) | PDF
Angular
and
Jasmine
@d_danailov
Topics Today
● What is TDD and Unit Testing
● What is Jasmine
● Horrible Mistakes (Possible Mistakes)
● Examples
Priorities and Management
Code Base:
Monolithic Applications
Image Source: memegenerator.net
Team Size
Challenges
Team Size
Long time
TDD
and
Unit Testing
Image Source: niden.net
Unit Testing
● Only on memory
● Fast
● Repeatable
● Not touch any external resources
Class Voice Recognition
function Record(object) // void function
Voice Recognition API
Class Voice Recognition
function Record(object) // void function
Voice Recognition API
Fake Voice Recognition API -
Mockup Object (Assert)
Mock objects vs Stub objects
function Record(object) // void function
Voice Recognition API
LogWritter
Mock objects vs Stub objects
function Record(object) // void function
Voice Recognition API
LogWritter
Mock objects vs Stub objects
function Record(object) // void function
Voice Recognition API
LogWritter
Fake Voice Recognition API
Fake LogWritter
Mock objects vs Stub objects
function Record(object) // void function
Voice Recognition API
LogWritter
Fake Voice Recognition API - Stub
Fake LogWritter -
Mockup Object
(Assert)
Understanding Mock Objects - Roy Osherove
Possible
Horrible Mistakes
Image Source: bryanmmathers.com
GOTO 2013 • JS Unit Testing Good Practices & Horrible Mistakes • Roy Osherove
Image Source: media.bsix12.com
Image Source: media.licdn.com
Just by doing it,
Unit Testing Makes
Your file easier
Possible
Horrible Mistake
Unit testing makes your developer
lives easier
● Easier to find bugs
● Easier to maintain
● Easier to understand
● Easier to Developer
Unit test have bugsNo TrustRefactoringTest Code is not an
important
No Test Review
Possible
Horrible Mistake
Test reviews vs code reviews
● Understand intent of developer
● 10 times quicker
● Drill in when needed
● Important for learning teams
Test reviews
● Making your test TRUSTworthy
● Creating MAINTAINable tests
● READable tests
RTFM
Mocking all the things
Possible
Horrible Mistake
Faking
Mock objects vs Stub objects
function Record(object) // void function
Voice Recognition API
LogWritter
Fake Voice Recognition API - Stub
Fake LogWritter -
Mockup Object
(Assert)
Mixing Unit And Integration Tests
Possible
Horrible Mistake
Unit Testing
● Only on memory
● Fast
● Repeatable
● Not touch any external resources
The Testing Diamond
and the Pyramid by
Todd Little
Article: The Testing Diamond and the Pyramid
Image Source: pinterest.com
Play by Play: Angular Testing with John Papa and Ward Bell
Article: The power of lazy programming
Image Source: media.licdn.com
Лекцията на Aлекс Тодоров: Мутанти, зомбита и тестове
jpapa.me/yohottowel
25 % Discount - Valid for first ten
registrations (FriendOfMitko)
Resources
http://bit.ly/angular-jasmine
Questions

DEV.BG - Angular 1 and Jasmine (Unit Testing and TDD)