|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnz.ac.waikato.modeljunit.Tester
nz.ac.waikato.modeljunit.RandomTester
public class RandomTester
Test a system by making random walks through an EFSM model of the system.
Field Summary | |
---|---|
static double |
DEFAULT_RESET_PROBABILITY
During random walk (including buildGraph), this is the default probability of doing reset() rather than choosing a random transition. |
Fields inherited from class nz.ac.waikato.modeljunit.Tester |
---|
FIXEDSEED, model_, rand_ |
Constructor Summary | |
---|---|
RandomTester(FsmModel fsm)
A convenience constructor that puts a Model wrapper around an FsmModel. |
|
RandomTester(Model model)
Creates a test generator that can generate random walks. |
Method Summary | |
---|---|
int |
doRandomAction()
Take any randomly-chosen Action that is enabled. |
int |
doRandomActionOrReset()
Randomly take an enabled transition, or do a reset with a certain probability (see getResetProbability() ). |
int |
generate()
Generates one step of a random walk through the model. |
java.lang.String |
getDescription()
A brief description of this test generation algorithm. |
java.lang.String |
getName()
The name of this test generation algorithm. |
double |
getResetProbability()
The probability of spontaneously doing a reset rather than a normal transition during random walks etc. |
void |
setResetProbability(double prob)
Set the probability of doing a reset during random walks. |
Methods inherited from class nz.ac.waikato.modeljunit.Tester |
---|
addCoverageMetric, addListener, addListener, addListener, buildGraph, buildGraph, buildGraph, buildGraphBreadthFirst, generate, getModel, getRandom, printCoverage, reset, setRandom |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final double DEFAULT_RESET_PROBABILITY
Constructor Detail |
---|
public RandomTester(Model model)
model
- Must be non-null;public RandomTester(FsmModel fsm)
fsm
- Must be non-null.Method Detail |
---|
public java.lang.String getName()
Tester
getName
in class Tester
public java.lang.String getDescription()
Tester
getDescription
in class Tester
public double getResetProbability()
public void setResetProbability(double prob)
If this is set to 0.0, then resets will only be done when we reach a dead-end state (no enabled actions). This means that if the FSM contains a loop that does not have a path back to the initial state, then the random walks may get caught in that loop forever. For this reason, a non-zero probability is recommended.
The default probability is DEFAULT_RESET_PROBABILITY
.
prob
- Must be at least 0.0 and less than 1.0.public int doRandomAction()
public int doRandomActionOrReset()
getResetProbability()
).
If this method is called in a state where
there are no Actions enabled, then it will perform
a reset
to start from the initial state again.
public int generate()
doRandomActionOrReset()
.
generate
in class Tester
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |