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 HCL OneTest™
UI 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 (java.lang.String vpName, java.lang.Object
actual)
IFtVerificationPoint vpManual (java.lang.String vpName, java.lang.Object
expected, java.lang.Object actual)
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 HCL OneTest™
UI 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 (java.lang.String vpName)
IFtVerificationPoint vpDynamic (java.lang.String vpName, TestObject
objectUnderTest)
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", AnAWTButtonButton()).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", AnAWTButtonButton()); //ERROR. Nothing happens.