Test your nodejs code
-
Upload
damien-klinnert -
Category
Technology
-
view
563 -
download
4
description
Transcript of Test your nodejs code
test your nodejs code an opinionated introduction by Damien Klinnert
1Freitag, 23. November 12
whois damienklinnert
student of computer science
works at doctape
jsdev since beginning of 2012
follow me @damienklinnert
2Freitag, 23. November 12
unit tests???
3Freitag, 23. November 12
what is it?
4Freitag, 23. November 12
advantages of unit tests
JS is a dynamic language
additional lines of code, but less errors
continous integration -> less errors over time
NOT THE ANSWER TO EVERYTHING
5Freitag, 23. November 12
test your nodejs code
6Freitag, 23. November 12
tools
mocha
should
npm
couchviews
couchpenter
nock
travis-ci
7Freitag, 23. November 12
tools/mocha
feature-rich JavaScript test framework
many different test outputs
can create documentation
only a few keywords to remember like:
describe(), it(), before(), after(), beforeEach(), afterEach()
8Freitag, 23. November 12
tools/should
expressive, readable, test framework agnostic, assertion library
extends the Object prototype
should … exist, have.keys, equal, throwError()
9Freitag, 23. November 12
tools/npm
npm comes with script support
no need for makefiles for common tasks like "run all tests" or "generate docs"
10Freitag, 23. November 12
demo time
11Freitag, 23. November 12
tools/couchviews
Store and load CouchDB views to / from your file system for easier setup of new databases
12Freitag, 23. November 12
tools/couchpenter
CouchDB database and document setup tool
CLI to setup new couchdb‘s from a json file
13Freitag, 23. November 12
tools/nock
HTTP HTTP mocking library
create api test environments
14Freitag, 23. November 12
tools/travis-ci
A hosted continuous integration service for the open source community.
15Freitag, 23. November 12
readinghttp://visionmedia.github.com/mocha/
https://github.com/visionmedia/should.js/
https://npmjs.org/doc/
https://github.com/damienklinnert/couchviews
https://github.com/cliffano/couchpenter
https://github.com/flatiron/nock
http://travis-ci.org/16
Freitag, 23. November 12
thank you
17Freitag, 23. November 12