test driven development in meteor

19
Test-driven development Why we should use it

Upload: michael-lazarski

Post on 07-Jan-2017

587 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Test driven development in meteor

Test-driven development

Why we should use it

Page 2: Test driven development in meteor

The need for testing

To err is human( Everyone makes mistakes )

and it is okay

Page 3: Test driven development in meteor

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

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

What is Test-driven development

Page 6: Test driven development in meteor

What is Test-driven development

Page 7: Test driven development in meteor

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

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

Benefits of tdd (sales/product Team)

From “Test-driven JavaScript Development” by Christian Johansen

Page 10: Test driven development in meteor

Benefits of tdd (sales/product Team)

Source: http://www.nist.gov/director/planning/upload/report02-3.pdf

Page 11: Test driven development in meteor

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

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

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

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

Quick example

Page 16: Test driven development in meteor
Page 17: Test driven development in meteor
Page 18: Test driven development in meteor

Quick example

Page 19: Test driven development in meteor