You will create a text checkpoint on a date
text string that changes according to the selected flight date. You can define
the date as a regular expression so that the checkpoint checks that the captured
text string matches the expected format, rather than checking the exact text.
To do this, you will create a text checkpoint with a regular
expression that will match any single character within a defined range.
- Start QuickTest and open the Recording test.
- Save the test as RegExpression.
- Confirm that the Active Screen option is enabled.
- Select the text for which you will create the checkpoint.
- Enter the regular expression for the text you want to check.
- Rename the checkpoint.
- Save the test.
If QuickTest is not already open, choose Start > Programs > QuickTest Professional > QuickTest
Professional.
Choose File > Save As. Save the test as RegExpression.
If you do not see the Active Screen at the bottom of the
QuickTest window, click the Active Screen
button or choose View > Active Screen.
In the Keyword View, expand Welcome: Mercury: Tours and click the Select a Flight: Mercury page. The page is
displayed in the Active Screen.
In the Active Screen, scroll up and highlight the date for the
outbound flight, New York to San Francisco (12/29/2007). Right-click the highlighted string and select
Insert Text Checkpoint. The Text Checkpoint
Properties dialog box opens.
In the Checked Text area,
click the Constant Value Options button . The Constant Value
Options dialog box opens.
In the Value box, replace the
displayed date with [0-1][0-9]/[0-3][0-9]/200[0-9].
This instructs QuickTest to check that each character in the selected text
matches the number-range format defined by the regular expression. The
expression checks for the following format: MM/DD/200Y.
Select the Regular expression
check box. A message box prompts you to insert the backslash character before
each special character. Click No.
Note: Clicking Yes would
cause QuickTest to treat the special characters ( [ ), ( - ) and ( ] ) as literal characters and not as a regular expression.
Click OK to close the Constant
Value Options dialog box.
In the Name box, enter CheckExpectedText as the new checkpoint name.
Click OK to accept the other
default settings and close the Text Checkpoint Properties dialog box.
QuickTest adds the text checkpoint to your test. It is
displayed as a check operation on the Select a
Flight: Mercury page in the Keyword View.
Choose File > Save or click
the Save button .
No comments:
Post a Comment