|
Rational QualityArchitect/Java API Version 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.rational.test.vp.VerificationPoint
This class contains the verification point's metadata -- that is, the information that determines the data to capture for this verification point. Examples of verification point metadata include the list of properties for a user-defined object properties verification point, or connection information and SELECT statements for the JDBC database verification point that is included in this package.
Don’t confuse metadata with the data being verified. The data being verified is
encapsulated by an implementation of the interface VerificationPointData
.
A verification point’s metadata can be defined in either of these ways:
set...
methods in your specialized VerificationPoint class.
If the metadata has not been explicitly specified and no metadata exists for
this verification point in the datastore, the framework calls the
defineVPcallback()
method in your specialized VerificationPoint
class. Your implementation of this method should provide some means of retrieving
the verification point’s metadata -- typically through some UI that prompts the
tester for the information. When the metadata is retrieved, the framework stores
it in the datastore.
This class is also responsible for implementing its own serialization. By requiring your specific verification point implementations to perform their own serialization, all file formats (such as INI, XML, and standard Java serialization) can be supported.
This abstract
class defines the metadata for and partially implements
the behavior of a verification point. Because the VerificationPoint
class
is abstract, it cannot be instantiated. Rather, all verification point classes,
including the classes you create, extend from this class, implementing the abstract
methods necessary to specialize themselves, and inheriting the rest of their behavior
from this class.
As the verification point implementer, you must implement all abstract methods.
The VerificationPoint
class is part of the
verification point framework that you use to
implement your own verification point classes. The verification point framework also includes:
VerificationPointData
interface
VerificationPointDataProvider
interface
VerificationPointDataRenderer
interface
VerificationPointComparator
interface
Field Summary | |
protected boolean |
bIsDefined
If true , indicates that the verification point's metadata
is fully specified. |
protected boolean |
bIsValid
If true , indicates that the verification point
was correctly instantiated, successfully captured, and
is in a valid state -- otherwise false . |
static int |
COMPARE_CASEINSENSITIVE
Specifies that the verification should be case insensitive. |
static int |
COMPARE_CASESENSITIVE
Specifies that the verification should be case sensitive (default). |
static int |
OPTION_EXPECT_FAILURE
Specifies that the verification point's expected result is failure. |
static int |
OPTION_USER_ACKNOWLEDGE_BASELINE
Specifies that the first run of a static verification point should display the captured data for the tester to validate before storing it as the expected (baseline) data object. |
protected java.lang.String |
sFailureDescription
Specifies the reason for a failure. |
static int |
VERIFICATION_ERROR
An error occured, and the verification point was not performed. |
static int |
VERIFICATION_FAILED
The verification point was performed, and the comparison failed. |
static int |
VERIFICATION_NO_RESULT
The static verification point was run for the first time, and a baseline (expected) data object was successfully captured. |
static int |
VERIFICATION_SUCCEEDED
The verification point was performed, and the comparison passed. |
Constructor Summary | |
VerificationPoint(java.lang.String sVPname,
java.lang.Class cVPdataClass,
java.lang.Class cVPdataProviderClass,
java.lang.Class cVPdataRendererClass,
java.lang.Class cVPcompClass)
This constructor stores the name of the verification point and the classes that provide serialization and comparison services for the verification point. |
Method Summary | |
abstract java.lang.String |
codeFactory_getConstructorInvocation()
This code factory method returns a parameterized constructor call. |
abstract java.lang.String |
codeFactory_getExternalizedInputDecl(int nInput)
This code factory method returns a variable declaration. |
abstract int |
codeFactory_getNumExternalizedInputs()
This code factory method returns the number of responses (inputs) that a tester provided when defining verification point metadata interactively through a UI. |
java.lang.String |
codeFactory_getPrefix()
This code factory method retrieves the user-defined prefix that is currently available to prepend to a variable name to make the name unique. |
abstract java.lang.String |
codeFactory_getStaticInvocation()
This code factory method sends back a static invocation declaration. |
void |
codeFactory_setPrefix(java.lang.String sSelfDescribePrefix)
This code factory method specifies a user-defined prefix to prepend to the current set of variable names created and declared by the codeFactory_getExternalizedInputDecl() method. |
abstract boolean |
defineVPcallback()
This method should provide a way to capture the metadata for the verification point -- typically, by presenting the tester with a UI device, such as the Query Builder tool provided with Rational QualityArchitect for use with the database verification point). |
boolean |
getIsDefined()
This method retrieves the value of the field. |
TestLog |
getLog()
|
java.lang.String |
getLogActualFile()
Internal use only. |
java.lang.String |
getLogBaselineFile()
Internal use only. |
java.lang.String |
getLogMetaFile()
Internal use only. |
java.lang.String |
getMasterBaselineFile()
Internal use only. |
java.lang.String |
getMasterMetaFile()
Internal use only. |
int |
getOptions()
This method retrieves the options associated with the current verification point. |
java.lang.String |
getVPname()
This method retrieves the name of the current verification point. |
protected void |
initializeVP(boolean bVPdefined)
For internal use only. |
int |
performTest(java.lang.Object objTarget)
This method performs a static verification point. |
int |
performTest(java.lang.Object objTarget,
VerificationPointData vpsExpected)
This method performs a dynamic verification point. |
int |
performTest(java.lang.Object objTarget,
VerificationPointData vpsExpected,
VerificationPointData vpsActual)
This method performs a manual verification point. |
abstract void |
readFile(java.io.InputStream in)
This method deserializes a verification point object from the specified InputStream. |
void |
setIsDefined(boolean bIsDefined)
This method assigns a value to the field. |
void |
setOptions(int iOptions)
This method sets the options for the current verification point. |
void |
setVPname(java.lang.String sVPname)
This method sets the name of the current verification point. |
abstract void |
writeFile(java.io.OutputStream out)
This method serializes the verification point object to the specified OutputStream. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected transient boolean bIsValid
true
, indicates that the verification point
was correctly instantiated, successfully captured, and
is in a valid state -- otherwise false
.protected transient boolean bIsDefined
If true
, indicates that the verification point's metadata
is fully specified. If false
when a performTest()
method is invoked, the framework will call
the defineVPcallback()
method on behalf of the test script in
an attempt to get a complete set of verification point metadata from the tester.
Note that this field applies to the verification point metadata, not to the data itself that is captured in accordance with the metadata.
protected transient java.lang.String sFailureDescription
public static final int COMPARE_CASESENSITIVE
public static final int COMPARE_CASEINSENSITIVE
public static final int OPTION_USER_ACKNOWLEDGE_BASELINE
public static final int OPTION_EXPECT_FAILURE
public static final int VERIFICATION_ERROR
public static final int VERIFICATION_SUCCEEDED
public static final int VERIFICATION_FAILED
public static final int VERIFICATION_NO_RESULT
Constructor Detail |
public VerificationPoint(java.lang.String sVPname, java.lang.Class cVPdataClass, java.lang.Class cVPdataProviderClass, java.lang.Class cVPdataRendererClass, java.lang.Class cVPcompClass)
This constructor stores the name of the verification point and the classes that provide serialization and comparison services for the verification point.
This constructor can never be called from a test script because the
VerificationPoint
class is abstract. A specific verification point
implementation (such as the database
verification point
or any custom verification points that you implement) extends
the VerificationPoint
class and invokes this constructor from
within its own constructor using the super
keyword -- for example:
public MyVerificationPoint( String sVPname ) { super(sVPname, MyVPData.class, MyVPDataProvider.class, MyVPDataRenderer.class, MyVPComparator.class); . . . }
sVPname
- A user-defined name for the verification point. 40 characters maximum.cVPdataClass
- The class responsible for serialization of
one set of the verification point's data.cVPdataProviderClass
- The class responsible for capturing the verification
point's data and populating a
VerificationPointData
object with the data.cVPdataRendererClass
- The class responsible for visually rendering the data
stored in an object of this verification point's
VerificationPointData
class.cVPcompClass
- The class responsible for comparing two sets
of this verification point's data.
Note: The classes passed in the
cVPdataClass
, cVPdataProviderClass
,
cVPdataRendererClass
, and cVPcompClass
parameters
are passed to the constructor to allow late-binding to the methods in the classes.
Method Detail |
public abstract java.lang.String codeFactory_getConstructorInvocation()
This code factory method returns a parameterized constructor call.
This method is never called from the test script. This method is called during the following Rational code generation operations:
This method returns a parameterized constructor call. This call plus the
variables declared by codeFactory_getExternalizedInputDecl()
allow the code generators listed above to create a fully specified verification
point in the generated test script code.
public abstract java.lang.String codeFactory_getExternalizedInputDecl(int nInput)
This code factory method returns a variable declaration.
This method is never called from the test script. This method is called during the following Rational code generation operations:
The Rational code generators (the Rational QualityArchitect Session Recorder and the
Rational Rose scenario test generator) call this
code factory method in a loop that iterates as many times as there are variables to declare
(that is, the number returned from codeFactory_getNumExternalizedInputs()
).
The code returned by codeFactory_getConstructorInvocation()
use the variables declared with codeFactory_getExternalizedInputDecl()
.
nInput
- A number that indicates the current variable to declare. The number
should be initialized to 0 and incremented by 1 in the loop.public abstract int codeFactory_getNumExternalizedInputs()
This code factory method returns the
number of responses (inputs) that a tester provided when defining verification
point metadata interactively through a UI. The UI was presented to the tester
through the defineVPcallback()
method.
This method is never called from the test script. This method is called during the following Rational code generation operations:
public java.lang.String codeFactory_getPrefix()
This code factory
method retrieves the user-defined prefix that is currently available
to prepend to a variable name to make the name unique.
Use the prefix whenever you are constructing a set of variable names
for use with the codeFactory_getConstructorInvocation()
and codeFactory_getExternalizedInputDecl()
methods.
Call this method only if you are implementing a new verification point.
public abstract java.lang.String codeFactory_getStaticInvocation()
This code factory method sends back a static invocation declaration.
This method is never called from the test script. This method is called during the following Rational code generation operations:
This method returns a static invocation line. This line of code is required to capture the baseline data for the Verification Point when the test script is first run and then to validate that baseline data with each subsequent execution of the test script.
public void codeFactory_setPrefix(java.lang.String sSelfDescribePrefix)
This code factory method specifies
a user-defined prefix to prepend to the current set of variable names created
and declared by the codeFactory_getExternalizedInputDecl()
method.
The variable-name prefix is used to ensure that variable names are unique when the Rational code generator features (the Rational QualityArchitect Session Recorder) and the Rational Rose scenario test generator) insert more than one verification point into a given scope.
This method is called by the Rational QualityArchitect code generators.
sSelfDescribePrefix
- The prefix to prepend to the variable names.public abstract boolean defineVPcallback()
This method should provide a way to capture the metadata for the verification point -- typically, by presenting the tester with a UI device, such as the Query Builder tool provided with Rational QualityArchitect for use with the database verification point).
Implement this method only if you are implementing a new verification point.
The framework automatically invokes
this method if the verification point's metadata is not fully defined when the
performTest()
method is invoked.
defineVPcallback()
is invoked, it should capture, presumably
through some UI, any information necessary to fully define the metadata for the
verification point, and then populate the verification point's attributes with
the captured metadata. For example, the defineVPcallback()
method included with the database verification point
provided with Rational QualityArchitect invokes the Query Builder software.
Query Builder captures JDBC connection information and a SQL statement, and then
populates the database verification point object with the captured metadata,
resulting in a fully defined verification point.
This method applies to the verification point metadata, not to the data itself that is captured in accordance with the metadata. The metadata is used by the specialized Verification Point Data Provider class to determine the data to capture.
If the verification point is being recorded through the Rational QualityArchitect
Session Recorder, or if it being generated through a Rational Rose model,
this method will be invoked at script generation time. The resulting
verification point metadata will automatically be provided to the test script.
As a result, the defineVPcallback()
method will not be invoked
at script playback time.
true
if the verification point metadata was captured,
false
otherwise. If the metadata was not captured,
the verification point will be in an invalid state, and it will log an error
if its performTest()
method is called.public boolean getIsDefined()
bIsDefined
field.public TestLog getLog()
public java.lang.String getLogActualFile()
public java.lang.String getLogBaselineFile()
public java.lang.String getLogMetaFile()
public java.lang.String getMasterBaselineFile()
public java.lang.String getMasterMetaFile()
public int getOptions()
public java.lang.String getVPname()
protected void initializeVP(boolean bVPdefined)
For internal use only.
public int performTest(java.lang.Object objTarget)
This method performs a static verification point.
In this implementation, performTest()
performs and logs a
regression-style verification. It does so by checking the
datastore for an expected (baseline) data object and then comparing the expected
data object to the actual data object that is captured in this call.
If there
is no expected data object in the datastore, the call creates one and returns a
VERIFICATION_NO_RESULT
status for this run of the verification point.
However, if there is no expected data, but the test script specifies the
OPTION_USER_ACKNOWLEDGE_BASELINE
option in the
setOptions()
method, the framework first invokes an implementer-defined
UI that prompts the tester to verifiy that the captured data is correct:
VERIFICATION _SUCCEEDED
.
objTarget
- The object-under-test. If the verification point operates
on an object that is not directly accessible (for example,
a remote object or a database), the verification point object must
contain the information needed to find the object-under-
test, and the value of objTarget
is ignored.public int performTest(java.lang.Object objTarget, VerificationPointData vpsExpected)
This method performs a dynamic verification point.
In this implementation, performTest()
captures an actual data object
from the component-under-test, compares the actual data object to the expected
data object that was passed to the call, and logs the results of the comparison.
objTarget
- The object-under-test. If the verification point operates
on an object that is not directly accessible (for example,
a remote object or a database), the verification point object must
contain the information needed to find the object-under-
test, and the value of objTarget
is ignored.vpsExpected
- An expected data object. The test script can construct the expected
data object, or it can deserialize the expected data object from a
file that is not managed by the Rational datastore.public int performTest(java.lang.Object objTarget, VerificationPointData vpsExpected, VerificationPointData vpsActual)
This method performs a manual verification point.
In this implementation,performTest()
specifies both the
expected data object and the actual data object. This allows a test script
to capture or construct the actual data object, rather than relying on
the Verification Point Data Provider class to create the actual data object.
This call simply compares the actual and expected data objects that are passed to it and logs the results of the comparison.
objTarget
- The object-under-test. If the verification point operates
on an object that is not directly accessible (for example,
a remote object or a database), the verification point object must
contain the information needed to find the object-under-
test, and the value of objTarget
is ignored.vpsExpected
- An expected data object. The test script can construct the expected
data object, or it can deserialize the expected data object from a
file that is not managed by the Rational datastore.vpsActual
- The actual data object. This object was captured or constructed
by code in the test script.public abstract void readFile(java.io.InputStream in) throws java.io.IOException
in
- The InputStream from which the object is read.java.io.IOException
- An error has occurred in attempting
to read from the InputStream.public void setIsDefined(boolean bIsDefined)
bIsDefined
field.public void setOptions(int iOptions)
iOptions
- One or more options to assign to the verification point.
Options can be pre-defined, such as COMPARE_CASESENSITIVE
,
COMPARE_CASEINSENSITIVE
, and OPTION_USER_ACKNOWLEDGE_BASELINE
,
or any user-defined options.public void setVPname(java.lang.String sVPname)
sVPname
- The name to assign to the current verification point. 40 characters maximum.public abstract void writeFile(java.io.OutputStream out) throws java.io.IOException
out
- The OutputStream to which the object is written.java.io.IOException
- An error has occurred in attempting
to write to the OutputStream.
|
30-Jun-2003 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |