|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jwalk.core.Oracle
public class Oracle
Oracle is the test oracle used to store and predict test outcomes. An
Oracle is a data structure that maps from executed TestSequences to known
test Outcomes. When a JWalker's test modality is set to VALIDATE, this
causes an Oracle to be created for the current test class. Each executed
TestSequence is compared against known sequences in the Oracle and, if the
outcome can be predicted from existing information, the test is passed or
failed automatically, otherwise the user is asked to confirm or reject the
novel outcome, which is then added to the Oracle.
Oracles are saved in plain text files with the extension ".jwk", containing
lists of key test sequences. A block of correct sequences appears first,
followed by a blank line separator, then a block of incorrect sequences (if
any). Each sequence consists of an encoded string, representing the
actual invocation and arguments used, then the equals-sign, then the
corresponding result. Deleting single lines from an Oracle data file is
the chief way of causing JWalkers to "forget" certain learned outcomes
altogether; whereas re-validating a test class is the chief way to re-train
the Oracle, in the light of modifications made to the test class.
Field Summary | |
---|---|
protected java.util.Map<java.lang.String,java.lang.String> |
correct
The collection of known correct test results, indexed by long key. |
protected java.util.Map<java.lang.String,java.lang.String> |
incorrect
The collection of known incorrect test results, indexed by long key. |
protected JWalker |
walker
The JWalker which requested this Oracle. |
Constructor Summary | |
---|---|
Oracle(JWalker walker)
Creates an Oracle for a particular JWalker. |
Method Summary | |
---|---|
boolean |
close()
Closes this Oracle, saving its test data. |
boolean |
open()
Opens this Oracle, reading its test data. |
Outcome |
validate(TestSequence sequence)
Validate a TestSequence from information known to this Oracle. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected JWalker walker
protected java.util.Map<java.lang.String,java.lang.String> correct
protected java.util.Map<java.lang.String,java.lang.String> incorrect
Constructor Detail |
---|
public Oracle(JWalker walker)
walker
- the JWalker for whom this Oracle was created.Method Detail |
---|
public boolean open()
public boolean close()
public Outcome validate(TestSequence sequence)
sequence
- the TestSequence to validate.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |