-
Notifications
You must be signed in to change notification settings - Fork 21
simpletest
The TEAL plugin uses the RAVEN regression test framework. The regression tests for the plugins have to be placed in the ~/TEAL/tests directory and registered in the ~/TEAL/tests/tests file. In addition, the output to be compared to in order to assess pass or failure of the test, i.e. the test's gold file should be placed in the ~/TEAL/tests/gold folder.
To run the test manually:
- Install RAVEN devel
- Install the development version of the plugin using the plugin install script provided by RAVEN. For more information, see the RAVEN user manual (Section "How to create a RAVEN ExternalModel plugin"). Mainly, in the RAVEN folder , run:
cd <path to RAVEN>/raven
scripts/install_plugins.py -s <path to plugin>/TEAL
Note: The is the path to the plugin where you currently develop, not the sub-module in RAVEN.
- Run the RAVEN regression test script running only the plugin tests.
./run_tests --re=plugins/TEAL
In order to be accepted by RAVEN, the plugin's tests should cover at least 80% of the code. The python tool coverage is used to compute the code coverage. The tool has to be installed first.
To run a code coverage test run:
cd <path to RAVEN>/raven
export COVERAGE_FILE=`pwd`/.coverage
coverage erase
coverage run --rcfile=./tests/framework/.coveragerc --append --source=plugins/TEAL/src/Cash_Flow.py framework/Driver.py plugins/TEAL/tests/CashFlow_test_IRR.xml
coverage run --rcfile=./tests/framework/.coveragerc --append --source=plugins/TEAL/src/Cash_Flow.py framework/Driver.py plugins/TEAL/tests/CashFlow_test_NPVsearch.xml
coverage run --rcfile=./tests/framework/.coveragerc --append --source=plugins/TEAL/src/Cash_Flow.py framework/Driver.py plugins/TEAL/tests/CashFlow_test_NPV.xml
coverage run --rcfile=./tests/framework/.coveragerc --append --source=plugins/TEAL/src/Cash_Flow.py framework/Driver.py plugins/TEAL/tests/CashFlow_test_PI.xml
coverage report --rcfile=./tests/framework/.coveragerc
For nice html output run the following. The html page will be stored in ./coverage_html_report/index.html and can be opened with any browser.
coverage html --rcfile=./tests/framework/.coveragerc