-
Notifications
You must be signed in to change notification settings - Fork 21
tests
This document is in progress
For automtically testing our application we decided to use some commonly used tools by node.js developers. If you write tests for the n-odata-server we encourage you to use these tools.
Those are:
- mocha as test framework. You have to install it globally
- chai as assertion library. It is installed locally by the project
For writing tests just have a look into the test
folder and see how we did our other tests.
If you have a better idea just discuss it with us in our Slack.
To run the tests you simply execute
npm test
on the command line.
If you want to get the code coverage evaluated by istanbul you have to run
npm test --coverage
or
npm run coverage
The coverage data is saved in folder ./coverage
. A html report of the coverage is saved in file ./coverage/lcov-report/index.html
.
To debug your tests in Chrome do the following.
Open a terminal and enter
node-inspector
(must have been installed, see link below for more details)
Open another terminal and enter
mocha --debug-brk test/**
Open Chrome an go to the URL
http://127.0.0.1:8080/?ws=127.0.0.1:8080&port=5858
After a few seconds the debugger should stop at the first line of code.
Here are some useful links to get familiar with testing in detail.