|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Interface Summary | |
---|---|
CoverageMetric | An interface to a test coverage metric. |
Class Summary | |
---|---|
AbstractCoverage | A partial implementation of CoverageMetric. |
ActionCoverage | Measures the number of distinct Actions that have been tested. |
CoverageHistory | A wrapper class that adds history recording to any CoverageMetric. |
StateCoverage | Counts the number of times each state has been entered. |
TransitionCoverage | Measures the number of Transitions that have been tested. |
TransitionPairCoverage | Measures the number of distinct Actions that have been tested. |
The classes in this package implement various metrics for measuring the coverage of the model when a test suite is generated. It is usually a good idea to use these metrics to check that you have generated enough tests to cover the majority of the behaviours of the model. For small or medium sized models (up to 100 transitions), a good minimum metric is to monitor transition coverage and aim to cover 100% of the transitions.
As well as using the metrics provided by this package to monitor model coverage, it is also wise to monitor the code coverage of your system under test (SUT) if possible. This can be done using standard profiling or coverage tools for Java, or you could use Jumble (which mutates your SUT class and finds out how many of the possible mutations are caught by the tests).
To use these coverage metrics, you create an instance of
whichever coverage metric class you are interested in, then
add it to your ModelTestCase
object using the
addCoverageMetric
method. Then generate some
tests and the coverage metrics will be automatically recorded.
The ModelTestCase
class also provides methods
for removing one or all coverage metrics and querying the
current set of coverage metrics.
These methods are static, to make it convenient to configure the
same set of metrics for several different models and test suites.
If you want to implement new coverage metrics, you must implement the CoverageMetric interface. The AbstractCoverage class is provided to make this easier. It is a partial implementation of the CoverageMetric interface that maintains a map from coverage objects (for example, states or transitions or some new kind of object that you invent) to the number of times that coverage object has been traversed by the generated tests.
|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |