test driven development in meteor

Post on 07-Jan-2017

587 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Test-driven development

Why we should use it

The need for testing

To err is human( Everyone makes mistakes )

and it is okay

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.

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

What is Test-driven development

What is Test-driven development

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.

Benefits of tdd (sales/product Team)

Decreased Software Development Costs

Faster time to Marke

Determining When a Product Is Good Enough to Release

Benefits of tdd (sales/product Team)

From “Test-driven JavaScript Development” by Christian Johansen

Benefits of tdd (sales/product Team)

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

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.

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

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

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

Quick example

Quick example

top related