-
Notifications
You must be signed in to change notification settings - Fork 5
Testing
Genotet testing takes two major parts: front-end testing and server testing. Front-end testing relies on the server testing, which first uploads data onto the server and generates proper DB records, so that the front-end can successfully get the test data.
The simplest way to test everything is to use the batch script. Using this you do not need to worry about the test dependencies and execution order.
bash test/test.sh
Genotet requires a backend server at anytime to run properly, even during automated testing. The server accepts a config file which should direct data paths to dist/data folder during testing.
To run the server during testing:
node server/server.js --config=test/config
The test data under dist/data are from test/data and will be copied to dist/data when running:
gulp test
Genotet uses QUnit and PhantomJS2 to automate front-end testing. The test cases (QUnit.test) will be concatenated into a single test file genotet-test.js, which will be included in index.html only when gulp builds test. Gulp removes the non-production related scripts and resources from index.html when it builds default. However, it preserves testing related resources (wrapped by build:test comments) when it builds test. Therefore, index.html is no longer a static file but a source file to be built upon at src/index.html.
The data for testing is initially located at test/data and will be uploaded to dist during the server upload testing. Without the server testing uploads, the front-end will not be able to retrieve the data it expects.
View creation on system loading (previously written in test.js) is now only enabled in dev mode. View creation on system loading is now part of dev/view.js. Similar to automated testing, dev/*.js is loaded only when gulp builds dev.
Genotet uses Jasmine Node and Frisby to test the backend server. Frisby sends requests directly to the backend server and checks its responses.
The data for testing is located at test/data.
Make sure that jasmine-node is installed:
npm install -g jasmine-node
Tests can be run independent of gulp.
# It is necessary to clean the dist folder first,
# otherwise previously uploaded data will interfere with new tests.
gulp clean
jasmine-node test/jasmine-node