DEV.BG - Angular 1 and Jasmine (Unit Testing and TDD)
-
Upload
dimitar-danailov -
Category
Software
-
view
100 -
download
2
Transcript of DEV.BG - Angular 1 and Jasmine (Unit Testing and TDD)
Angularand
Jasmine
Topics Today
● What is TDD and Unit Testing● What is Jasmine● Horrible Mistakes (Possible Mistakes)● Examples
Priorities and Management
Code Base: Monolithic Applications
Team Size
Challenges
Team Size
Long time
TDDand
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
PossibleHorrible 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
PossibleHorrible 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
PossibleHorrible 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
PossibleHorrible 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)
Resourceshttp://bit.ly/angular-jasmine
Questions