Testing with Intern
Introduction
In the previous posts ["Testing Node applications with Intern framework"]({% post_url 2015-03-01-unit-tests-with-intern %}) I demostrated how to set up testing environment for unit tests with Intern and Grunt and in ["REST end to end testing Node applications with Intern framework"]({% post_url 2015-03-03-end-to-end-tests-with-intern %}) I demonstrated how to test REST endpoints with end to end tests in a speed of unit tests. Today I will show how to organize Quality Assurance environment for Unit, Integration and Functional tests.
Grunt and task conventions
Here are tasks which we are using while testing:
test- execute all tests (unit, integration, functional)testing- as above in a watch loop, reexecutes tests when implementation or test sources changestest-unit- execute unit teststesting-unit- as above in a watch loop, reexecutes tests when implementation or test sources changestest-functional- execute functionaltesting-functional- as above in a watch loop, reexecutes tests when implementation or test sources changestest-integration- execute integration teststesting-integration- as above in a watch loop, reexecutes tests when implementation or test sources changes
Require
var suite = require('intern!object')- require internal intern suite objectvar tester = require('../lib/restServerTester')- require AMD styled filevar express = require('intern/dojo/node!express')- require CommonJS modulevar swagger = require('intern/dojo/node!../../index')- require custom CommonJS module from relative path
REST end to end testing Node applications with Intern framework
Testing REST with Intern
Prepare environment for releasing to Maven Sentral Repository
Generate key for signing build package: import existing key gpg2 --keyserver x-hkp://pool.sks-keyservers.net --recv-keys 9EBCB0B3 or generate new gpg --gen-key and export it gpg2 --keyserver hkp://pool.sks-keyservers.net --send-keys A6BAB25C