Go to app folder, and type npm install for the first time,
start your mongoDB and redis server,
and then type node app to launch the server.
Go to test folder, and type npm install for the first time,
and then type ./test.sh to run all the tests.
Any test should be written in the file after the name pattern *-test.js.
To run a single test file or a specific set of tests, type ./test.sh test-files. E.g.
./test.sh skeleton-test.jsThe developer of the tests can decide whether to skip functional tests.
Take a look at helpers.js, using when(condition).describe(...) to enable a certain set of tests conditionally.
./test.sh will run all the tests including unit tests and functional tests.
To enable functional tests for RedisCacheProvider, set environment variable VMC_SERVICES to be
VMC_SERVICES='[{"name": "teenyurl-redis-cache", "options": { "host": "YOUR_REDIS_HOST", "port": YOUR_REDIS_PORT, "password": "YOUR_REDIS_PASSWORD" }}]' ./test.shPlease be noted: VMC_SERVICES is an array in JSON, to enable functional tests for RedisCacheProvider the element with teenyurl-redis-cache as name should be present.
To enable functional tests for MongoDbDataAccessor, set environment variable VMC_SERVICES to be
VMC_SERVICES='[{"name" : "teenyurl-mongodb", "options" : { "url" : "mongodb://localhost/test"}}]' ./test.shPlease be noted: VMC_SERVICES is an array in JSON, to enable functional tests for MongoDbDataAccessor the element with teenyurl-mongodb as name should be present.
If you installed Redis and MongoDB on local box, you can run app and functional tests locally:
To launch the app:
source local-env.sh
cd app
node appTo run with all functional tests:
source local-env.sh
cd test
./test.sh