test driven development in meteor
TRANSCRIPT
![Page 1: Test driven development in meteor](https://reader034.vdocument.in/reader034/viewer/2022042619/5870bf511a28ab0b4a8b6bc3/html5/thumbnails/1.jpg)
Test-driven development
Why we should use it
![Page 2: Test driven development in meteor](https://reader034.vdocument.in/reader034/viewer/2022042619/5870bf511a28ab0b4a8b6bc3/html5/thumbnails/2.jpg)
The need for testing
To err is human( Everyone makes mistakes )
and it is okay
![Page 3: Test driven development in meteor](https://reader034.vdocument.in/reader034/viewer/2022042619/5870bf511a28ab0b4a8b6bc3/html5/thumbnails/3.jpg)
The need for testing
To check if the software is functioning as per the requirements.
Tests allows you to make big changes to code quickly.
Tests help you really understand the design of the code you are working on.
![Page 4: Test driven development in meteor](https://reader034.vdocument.in/reader034/viewer/2022042619/5870bf511a28ab0b4a8b6bc3/html5/thumbnails/4.jpg)
The need for testing
Precisely locating the source of bugs
they act as a safety net
See if other parts of the code still run when you changed something
![Page 5: Test driven development in meteor](https://reader034.vdocument.in/reader034/viewer/2022042619/5870bf511a28ab0b4a8b6bc3/html5/thumbnails/5.jpg)
What is Test-driven development
![Page 6: Test driven development in meteor](https://reader034.vdocument.in/reader034/viewer/2022042619/5870bf511a28ab0b4a8b6bc3/html5/thumbnails/6.jpg)
What is Test-driven development
![Page 7: Test driven development in meteor](https://reader034.vdocument.in/reader034/viewer/2022042619/5870bf511a28ab0b4a8b6bc3/html5/thumbnails/7.jpg)
Benefits of tdd (for developer)
TDD helps you to realise when to stop coding.
Contrary to popular belief unit testing does not mean writing code slower.
Good unit tests can help document and define what something is supposed to do.
![Page 8: Test driven development in meteor](https://reader034.vdocument.in/reader034/viewer/2022042619/5870bf511a28ab0b4a8b6bc3/html5/thumbnails/8.jpg)
Benefits of tdd (sales/product Team)
Decreased Software Development Costs
Faster time to Marke
Determining When a Product Is Good Enough to Release
![Page 9: Test driven development in meteor](https://reader034.vdocument.in/reader034/viewer/2022042619/5870bf511a28ab0b4a8b6bc3/html5/thumbnails/9.jpg)
Benefits of tdd (sales/product Team)
From “Test-driven JavaScript Development” by Christian Johansen
![Page 10: Test driven development in meteor](https://reader034.vdocument.in/reader034/viewer/2022042619/5870bf511a28ab0b4a8b6bc3/html5/thumbnails/10.jpg)
Benefits of tdd (sales/product Team)
Source: http://www.nist.gov/director/planning/upload/report02-3.pdf
![Page 11: Test driven development in meteor](https://reader034.vdocument.in/reader034/viewer/2022042619/5870bf511a28ab0b4a8b6bc3/html5/thumbnails/11.jpg)
Transition to tdd
1. New features should be writen in a tdd manner.
2. test reviews in the beginning.
3. Slowley but steady increase test coverege in old code.
![Page 12: Test driven development in meteor](https://reader034.vdocument.in/reader034/viewer/2022042619/5870bf511a28ab0b4a8b6bc3/html5/thumbnails/12.jpg)
Testing in Meteor
Name Velocity laika chimp gagarin Meteor 1.3
Versionsoon
deprecateddeprecated v0.30 v0.4.12 (alpha)
Test runnermocha /
cucumbermocha mocha
Assertion Library
chai chai chai
webdriverGhostdrive /
Seleniumchromedriver
/ Selenium
![Page 13: Test driven development in meteor](https://reader034.vdocument.in/reader034/viewer/2022042619/5870bf511a28ab0b4a8b6bc3/html5/thumbnails/13.jpg)
Setting up gagarin
1. create a folder test/gagarin in your project2. $ sudo npm -g i gagarin
3. Start your webdriver4. Start meteor
5. $ gagarin -B -c -m
![Page 14: Test driven development in meteor](https://reader034.vdocument.in/reader034/viewer/2022042619/5870bf511a28ab0b4a8b6bc3/html5/thumbnails/14.jpg)
example Requirment rock, paper, scissors rest api
winning function:
Player has rock and Computer has Paper
- Computer should win
Player has “something” and Computer has paper
- Should return a Error
![Page 15: Test driven development in meteor](https://reader034.vdocument.in/reader034/viewer/2022042619/5870bf511a28ab0b4a8b6bc3/html5/thumbnails/15.jpg)
Quick example
![Page 16: Test driven development in meteor](https://reader034.vdocument.in/reader034/viewer/2022042619/5870bf511a28ab0b4a8b6bc3/html5/thumbnails/16.jpg)
![Page 17: Test driven development in meteor](https://reader034.vdocument.in/reader034/viewer/2022042619/5870bf511a28ab0b4a8b6bc3/html5/thumbnails/17.jpg)
![Page 18: Test driven development in meteor](https://reader034.vdocument.in/reader034/viewer/2022042619/5870bf511a28ab0b4a8b6bc3/html5/thumbnails/18.jpg)
Quick example
![Page 19: Test driven development in meteor](https://reader034.vdocument.in/reader034/viewer/2022042619/5870bf511a28ab0b4a8b6bc3/html5/thumbnails/19.jpg)