This will add the MOcov directory to the Matlab and/or GNU Octave search path. If both Matlab and GNU Octave are available on your machine, it will install MOcov for both.
Coverage can be determined for evaluating a single expression or evaluation of a single function handle; for typical use cases this invokes running a test suite.
- Coverage information is stored internally by the function `mocov_line_covered`, which keeps this information through the use of persistent variables. Initially the coverage information is reset to being empty.
49
- This method considers all files in a directory (and its subdirectories).
50
- A temporary directory is created where modified versions of each file is stored.
51
- Prior to evaluting the expression or function handle, for each file, MOcov determines which of its lines can be executed. Each line that can be executed is prefixed by a call to `mocov_line_covered`, which cause it to update internal state to record the filename and line number that was executed, and the result stored in the temporary directory.
52
- The search path is updated to include the new temporary directory.
53
54
After evaluating the expression or function handle, the temporary directory is deleted and the search path restored. Line coverage information is then extracted from the internal state of `mocov_line_covered`.
55
56
This method runs on both GNU Octave and Matlab, but is typically slow.
to generate coverage reports for all files in the `'path/with/code'` directory when `running eval('run_test_command')`. Results are stored in JSON, XML and HTML formats.
- Use with continuous integration service, such as [Shippable] or [travis-ci] combined with [coveralls.io]. See the [travis.yml configuration file] in the [MOxUnit] project for an example.
MOcov can be used with the [Travis-ci] and [Shippable] services for continuous integration testing. This is achieved by setting up a `travis.yml` file. Due to recursiveness issues, MOcov cannot use these services to generate coverage reports for itself; for an example in the related [MOxUnit] project, see the [travis.yml configuration file] file.