diff options
author | Victor Woeltjen <victor.woeltjen@nasa.gov> | 2016-01-09 01:55:37 +0300 |
---|---|---|
committer | Victor Woeltjen <victor.woeltjen@nasa.gov> | 2016-01-09 01:55:37 +0300 |
commit | ed63e326feb43954277edff84d8c420b81f60877 (patch) | |
tree | c8e2169c034ba43b00878eb6c5cc46a2c82f239e /README.md | |
parent | 77e39f288213581a72050e2ce9de65861eea1e45 (diff) |
[API Refactor] Update documentation
...to reflect new manner in which tests are run.
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 47 |
1 files changed, 20 insertions, 27 deletions
@@ -43,29 +43,24 @@ that Open MCT Web (and its build and tests) execute correctly. ## Tests -The repository for Open MCT Web includes a test suite that can be run -directly from the web browser, `test.html`. This page will: - -* Load `bundles.json` to determine which bundles are in the application. -* Load `test/suite.json` to determine which source files are to be tested. - This should contain an array of strings, where each is the name of an - AMD module in the bundle's source directory. For each source file: - * Code coverage instrumentation will be added, via Blanket. - * The associated test file will be loaded, via RequireJS. These will - be located in the bundle's test folder; the test runner will presume - these follow a naming convention where each module to be tested has a - corresponding test module with the suffix `Spec` in that folder. -* Jasmine will then be invoked to run all tests defined in the loaded - test modules. Code coverage reporting will be displayed at the bottom - of the test page. - -At present, the test runner presumes that bundle conventions are followed -as above; that is, sources are contained in `src`, and tests are contained -in `test`. Additionally, individual test files must use the `Spec` suffix -as described above. - -An example of this is expressed in `platform/framework`, which follows -bundle conventions. +Tests are written for [Jasmine 1.3](http://jasmine.github.io/1.3/introduction.html) +and run by [Karma](http://karma-runner.github.io). To run: + +`npm test` + +The test suite is configured to load any scripts ending with `Spec.js` found +in the `src` hierarchy. Full configuration details are found in +`karma.conf.js`. By convention, unit test scripts should be located +alongside the units that they test; for example, `src/foo/Bar.js` would be +tested by `src/foo/BarSpec.js`. (For legacy reasons, some existing tests may +be located in separate `test` folders near the units they test, but the +naming convention is otherwise the same.) + +### Test Reporting + +When `npm test` is run, test results will be written as HTML to +`target/tests`. Code coverage information is written to `target/coverage`. + ### Functional Testing @@ -84,8 +79,7 @@ To run: Open MCT Web includes a Maven command line build. Although Open MCT Web can be run as-is using the repository contents (that is, by viewing -`index.html` in a web browser), and its tests can be run in-place -similarly (that is, by viewing `test.html` in a browser), the command +`index.html` in a web browser), the command line build allows machine-driven verification and packaging. This build will: @@ -93,8 +87,7 @@ This build will: * Check all sources (excluding those in directories named `lib`) with JSLint for code style compliance. The build will fail if any sources do not satisfy JSLint. -* Run unit tests. This is done by running `test.html` in a PhantomJS - browser-like environment. The build will fail if any tests fail. +* Run the [unit test suite](#tests). * Package the application as a `war` (web archive) file. This is convenient for deployment on Tomcat or similar. This archive will include sources, resources, and libraries for bundles, as well |