|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jwalk.JWalker org.jwalk.core.ClassInspector org.jwalk.core.ProtocolWalker org.jwalk.core.StateSpaceWalker
public class StateSpaceWalker
StateSpaceWalker exercises all the high-level states and transitions of the test class. A StateSpaceWalker explores the high-level states of the test class, and all transition paths of increasing length, starting in each of the states. It has a more abstract view of state than an AlgebraWalker, but exercises more transitions, corresponding to the n-switch cover.
Field Summary | |
---|---|
protected java.util.List<java.lang.reflect.Method> |
predicates
The subset of methods that are state predicates. |
protected java.util.Map<java.lang.String,TestSequence> |
stateCover
The map from state names to the state cover sequences. |
protected boolean |
stateFlag
The missing states flag that, when set to true, indicates that states were expected, but not found during the probing cycle. |
Fields inherited from class org.jwalk.core.ProtocolWalker |
---|
oracle, summary |
Fields inherited from class org.jwalk.core.ClassInspector |
---|
constants, constructors, methods, testClass |
Fields inherited from class org.jwalk.JWalker |
---|
channels, settings |
Constructor Summary | |
---|---|
StateSpaceWalker(Settings settings,
Channels channels)
Creates a StateSpaceWalker, using the settings and channels. |
Method Summary | |
---|---|
int |
countActiveEdges(int cycle)
Counts the number of active edges on a given test cycle. |
int |
countMaxStates()
Counts the maximum possible number of high-level design states. |
long |
countPermutations()
Counts the number of TestSequence permutations. |
protected void |
discoverStates()
Estimates the high-level design states of the test class. |
void |
execute()
Executes this StateSpaceWalker test strategy according to the settings. |
protected void |
executeProbeCycle(java.util.List<TestSequence> testSet,
int cycle)
Executes a probing cycle to determine whether new states were reached. |
protected void |
executeTestSeries()
Executes a series of test cycles for multiple high-level states. |
protected java.util.List<TestSequence> |
firstCycle(java.lang.String stateKey)
Creates the first test set placing the test object into a given state. |
java.util.Map<java.lang.String,TestSequence> |
getStateCover()
Returns the map from state names to state cover sequences. |
java.util.List<java.lang.reflect.Method> |
getStatePredicates()
Returns the list of state predicates for the test class. |
boolean |
hasMissingStates()
Reports if there are still missing states after exploration. |
protected boolean |
isPrunable(TestSequence sequence)
Reports whether a given TestSequence may be pruned. |
Methods inherited from class org.jwalk.core.ProtocolWalker |
---|
ensureExecutable, executeTestCycle, firstCycle, makeGenerator, nextCycle |
Methods inherited from class org.jwalk.core.ClassInspector |
---|
classIsAbstract, classIsEnum, classIsInterface, classNotPublic, countConstants, countConstructors, countMethods, getConstants, getConstructors, getMethods, getTestClass, inspectProtocols |
Methods inherited from class org.jwalk.JWalker |
---|
getChannels, getSettings, outOfMemory, run, userAborted |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean stateFlag
protected java.util.List<java.lang.reflect.Method> predicates
protected java.util.Map<java.lang.String,TestSequence> stateCover
Constructor Detail |
---|
public StateSpaceWalker(Settings settings, Channels channels)
settings
- the test parameter settings to use.channels
- the call-back channels to report on.Method Detail |
---|
public boolean hasMissingStates()
public int countMaxStates()
public java.util.Map<java.lang.String,TestSequence> getStateCover()
public java.util.List<java.lang.reflect.Method> getStatePredicates()
public long countPermutations()
countPermutations
in class ClassInspector
public int countActiveEdges(int cycle)
countActiveEdges
in class ClassInspector
cycle
- the test cycle number, 0..n.
protected boolean isPrunable(TestSequence sequence)
isPrunable
in class ProtocolWalker
sequence
- the TestSequence being evaluated.
protected java.util.List<TestSequence> firstCycle(java.lang.String stateKey)
stateKey
- the name of the state.
protected void executeProbeCycle(java.util.List<TestSequence> testSet, int cycle) throws PermissionException, GeneratorException, ExecutionException
testSet
- the current test set.cycle
- the test cycle number.
GeneratorException
- if any constructor or method argument value
could not be synthesised. A CustomGenerator must be provided that is
capable of synthesising values of the argument type.
ExecutionException
- if any constructor or method could not be
invoked, for reasons of visibility, security or bad arguments, or if
it is detected that a constructor or method behaves randomly.
PermissionException
- if the loaded test class, or any custom
generator, could not be instantiated, either for reasons of security,
or visibility, or because it was abstract, or an interface.protected void discoverStates() throws PermissionException, GeneratorException, ExecutionException
GeneratorException
- if any constructor or method argument value
could not be synthesised. A CustomGenerator must be provided that is
capable of synthesising values of the argument type.
ExecutionException
- if any constructor or method could not be
invoked, for reasons of visibility, security or bad arguments, or if
it is detected that a constructor or method behaves randomly.
PermissionException
- if the loaded test class, or any custom
generator, could not be instantiated, either for reasons of security,
or visibility, or because it was abstract, or an interface.protected void executeTestSeries() throws PermissionException, GeneratorException, ExecutionException
executeTestSeries
in class ProtocolWalker
GeneratorException
- if any constructor or method argument value
could not be synthesised. A CustomGenerator must be provided that is
capable of synthesising values of the argument type.
ExecutionException
- if any constructor or method could not be
invoked, for reasons of visibility, security or bad arguments, or if
it is detected that a constructor or method behaves randomly.
PermissionException
- if the loaded test class, or any custom
generator, could not be instantiated, either for reasons of security,
or visibility, or because it was abstract, or an interface.public void execute() throws PermissionException, GeneratorException, ExecutionException
execute
in class ProtocolWalker
GeneratorException
- if any constructor or method argument value
could not be synthesised. A CustomGenerator must be provided that is
capable of synthesising values of the argument type.
ExecutionException
- if any constructor or method could not be
invoked, for reasons of visibility, security or bad arguments, or if
it is detected that a constructor or method behaves randomly.
PermissionException
- if the loaded test class, or any custom
generator, could not be instantiated, either for reasons of security,
or visibility, or because it was abstract, or an interface.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |