This adds initial support for unit testing the javascript
functionality, by using the Jasmine javascript testing framework
(http://jasmine.github.io/) and the Jasmine-py
(https://github.com/jasmine/jasmine-py/) package to drive the
regression tests from python.
In this change:
- I added 2 simple javascript tests, see tests/spec/javascripts/profile_lnt_spec.js.
- Added integration for running these tests with lit, see tests/javascript_tests.py and tests/lit.cfg.
- Adapted an interface in lnt_profile.js, to make it easier to unit test (It also makes the interface cleaner, independent of unit testing needs).
- Unfortunately, there seems to be a problem with the jasmine pypi package: it installs fine with "pip install jasmine", but I get an error when trying to install it automatically when running "python ../lnt/setup.py develop": ValueError: bad marshal data (unknown type code)
The main reasons for picking Jasmine, out of quite a few different alternatives for javascript testing frameworks are:
- It seems to be one of the more popular and well-supported frameworks.
- It can easily be installed using "pip install".
- The jasmine-py package makes running the tests from python (e.g. lit) easy.
The tests are being run in a browser. When no browser is specified, a default one is used.
Probably, the most comfortable way to run these tests is to use the phantomjs head-less browser (http://phantomjs.org/).
The lit command line to run all tests (python + javascript ones) then looks like:
llvm-lit -sv -Dbrowser=phantomjs lnt/tests
As is, this isn't ready to be committed. First, the problem with installing the jasmine pypi
package as part of 'python ../lnt/setup.py develop' needs to be solved. I'm hoping to get
some review feedback on whether this looks like the right/a good direction for integrating
javascript testing into LNT's regression tests.