-
Notifications
You must be signed in to change notification settings - Fork 9
JavaScriptUnitTesting
felixKubicek edited this page Sep 19, 2014
·
9 revisions
All resources related to testing the JavaScript client-side code can be found in FuzzEd/tests/js-tests/.
The previously mentioned directory contains the following subdirectories:
-
src- contains the actual unit test modules, as well as an html file, called (test_tunner.html) used for initialization of the testing environment, as well as execution of the unit tests modules -
lib- contains libraries related to testing
The Unit tests can be executed in the following two ways:
- Open
test_tunner.htmlin a browser - Execute
python manage.py test FuzzEd.tests.test_json the command line (execution oftest_tunner.htmlusing the headless browser pluginmocha-phantomjs)
For reasons of compatibility (between source code and testing code) and uniformity, unit tests are also defined as requirejs modules.
When testing a source code module the related tests cases should be located in a module that has the same name like the source code module followed by _tests, as shown in the example below:
-
FuzzEd/static/script/job.js(source code module) -
FuzzEd/tests/js-tests/src/job_tests.js(related unit test module)