In this section:
- Code Coverage
- Configuring Code Coverage Measurement
- Running with Coverage
- Viewing Code Coverage Results
- Managing Code Coverage Suites
- Generating Code Coverage Report
Code coverage in RubyMine allows you to perform on-the-fly line coverage measuring for your code with low runtime overhead. In general, line coverage answers the question, "Was this line of code executed during unit testing simulation?"
- For a directory: the percentage of the covered classes and lines.
- For a file: the percentage of the covered lines.
When a file is opened in the editor, each line is highlighted with regard to its code coverage status:
- Lines executed during simulation are marked green.
- Lines not executed during simulation are marked red.
The coverage measurement results comprise a coverage suite. You can have the results of a new simulation merged with any existing suite. In this case, a line will be considered covered if it is covered by at least one of the simulations.
A coverage suite is generated every time a test or application with code coverage measurement is executed. It is possible to have an unlimited amount of coverage suites.
Running with coverage
- Make sure that the rcov or simplecov gem is installed, and Ruby is in your system path.
- Specify how you want to process the coverage results.
- Create tests for the target code, if you are going to measure code coverage for testing.
- Configure code coverage measurement in the desired run/debug configuration.
- Run with coverage, using the dedicated command on the main menu , or .
- Once the run with coverage has been executed, you can