Feature/test suite (#169)

* Adding first run of the test environment

* small tweaks

* Fixing tests suite to ohif-viewer

* Improving documentation and fixing versions

* Removing commented lines
This commit is contained in:
André Botelho Almeida authored and Erik Ziegler committed 2018-03-27 11:50:40 +02:00
1 parent 43a7e8151a
commit bf68707ff2
7 files changed
+325

No files matched your search

+50
View File
@@ -0,0 +1,50 @@
# Tests suite
## Tools
+ mocha as test runner.
+ ~~meteor package: practicalmeteor:mocha
https://github.com/practicalmeteor/meteor-mocha~~
+ meteor package: cultofcoders:mocha
https://github.com/cult-of-coders/meteor-mocha
+ Using cultofcoders because of this issue: https://github.com/practicalmeteor/meteor-mocha/issues/100
+ chai as assertion library meteor package:
+ practicalmeteor:chai https://github.com/practicalmeteor/meteor-chai
+ sinon as stubs, spies & mocking lib
+ practicalmeteor:meteor-sinon
+ meteor-coverage as tests coverage report (istanbul.js based)
+ https://atmospherejs.com/lmieulet/meteor-coverage
+ xolvio:template-isolator
+ Used for mock events on client side, like 'button click'.
+ spacejam:
+ Use it when you want run tests in a CI server. It has no browser dependency.
+ https://www.npmjs.com/package/spacejam
## Useful links
1. https://guide.meteor.com/testing.html
2. https://guide.meteor.com/writing-atmosphere-packages.html#testing
## Usage
```
$ cd Viewers
$ ./test/testPackages.sh [-c] -s
# -c for coverage | -s for spacejam
```
You can add more packages to be tested changing the line 7 in `testPackages.sh`:
```
TEST_PACKAGES=./Packages/ohif-viewerbase ./Packages/ohif-core ./Packages/ohif-etc
```
it does not work using path patterns like `./Packages/*` or `./Packages/`
Just open `http://localhost:3000` in your browser. The page going to be refreshed everytime you change the code.
Note: if you want to use spacejam, just install it before running.
+43
View File
@@ -0,0 +1,43 @@
#!/bin/bash
##################################################
# Runs the packages tests
##################################################
TEST_PACKAGES=./Packages/ohif-viewerbase
export METEOR_PACKAGE_DIRS="./Packages"
# check execution arguments
while [ "$1" != "" ]; do
PARAM=`echo $1 | awk -F= '{print $1}'`
case $PARAM in
-c | --coverage)
export RUN_COVERAGE=1
;;
-v | --verbose)
export COVERAGE_VERBOSE=1
;;
-s | --spacejam)
export RUN_SPACEJAM=1
;;
*)
esac
shift
done
if [ "$RUN_COVERAGE" == 1 ];
then
# Setting coverage variables
app_folder=$(pwd)
app_folder+=TEST_PACKAGES
export COVERAGE_APP_FOLDER=$app_folder
export COVERAGE=1
echo 'Running meteor-coverage'
fi
if [ "$RUN_SPACEJAM" == 1 ];
then
spacejam-mocha $TEST_PACKAGES
else
meteor test-packages --driver-package='cultofcoders:mocha' $TEST_PACKAGES
fi