Adding manual and dynamic verification points
In addition to verification points specified during recording, you can also incorporate new verification points into a Functional Test script. Scripting manual and dynamic verification points enables you to specify data for comparison against an object that is not found in the test object map. The data, however, must be value-class based.
For both the VpManual
method and the VpDynamic
method
you can refer to the entry for IFtVerificationPoint
in the
Rational® Functional Tester API Reference for information about restrictions
on verification point names and data formats.
Manual verification points
Manual verification points are useful when you create the data for the verification point yourself, and you want to compare the data. For example, the data could be the result of a calculation or could come from an external source, such as a database.
Manual verification
point objects are constructed using the VpManual
method.
When you call this method, you provide the data before PerformTest
is
executed. (The PerformTest
method saves the supplied data,
compares it when there is a baseline, and writes the result to the log.) The VpManual
method
has two signatures:
IFtVerificationPoint
VpManual (ByVal VpName As String, ByVal _
Actual As Object)
IFtVerificationPoint
VpManual (ByVal VpName As String, ByVal _
Expected As Object, ByVal Actual As Object)
The first form of VpManual
takes the name
of the verification point and the actual data that is either compared to an
existing baseline, or used to create a baseline if one does not already exist.
Note that this value can be null. The VpName
must
be unique relative to the script. For example:
VpManual ("manual1", "The rain in Spain").PerformTest()
The second form of this method adds a parameter for the expected data to be compared with the actual. Either expected or actual can be null valued. For example:
VpManual ("manual1", "The rain in Spain", _
"The Rain in Spain").PerformTest()
In this example, the data does not match. The PerformTest
method
would record a verification point failure message in the log.
Dynamic verification points
Dynamic verification points
are most useful when the TestObject
is not mapped and not
something that Rational® Functional Tester would normally test, for example, an object
that is not part of the application-under-test.
The VpDynamic
method
constructs dynamic verification points. Dynamic verification points raise
the appropriate user interface the next time the script is played back. The
user is able to insert verification point data tested against an object specified
by the script. In this way, the user can avoid having to run the test manually
to the appropriate state before recording the verification point. The vpDynamic
method
has two signatures:
IFtVerificationPoint VpDynamic (ByVal VpName As String)
IFtVerificationPoint VpDynamic (ByVal VpName As String, By Val _
ObjectTestObject As TestObject)
The first form of the VpDynamic
method requires
a unique (relative to the script) verification point name. The Recording Verification
Point and Action wizard is raised the next time the script is played back.
The user specifies the TestObject
and the baseline data
for subsequent runs to test against. The script must be run in interactive
mode. For example:
VpDynamic ("dynamic1").performTest()
The other form of the vpDynamic
method requires
specification of the TestObject. For example:
VpDynamic ("dynamic1", Pagetablelist()).PerformTest()
A modified UI, which does not display the TestObject
hierarchy,
appears on the first playback to specify data values for the baseline. While
the specified TestObject
does not have to be from the test
object map, it must be consistently the same object for the results to be
meaningful.
A common error when using these methods is to omit the PerformTest
method.
This is legal and compiles without warning, but no interesting action occurs
when the script runs. For example:
VpDynamic("test1", Pagetablelist()) ' ERROR. Nothing happens.