Recording check actions on controls
Insert validity checks during your recording sessions to generate action lines that check the output of the AUT during automated testing.
If the Car Rental application is running, return to the Login window; otherwise, start the application by selecting Start > All Programs > TestArchitect > Samples > Car Rental Application.
In TestArchitect, if you haven’t already done so, select Tools > Action Recorder Settings… and ensure that the settings are set as follows:
Then click OK.
注意:The Generate “navigate” action for web browser, Highlight element on hover, and Ignore formatting tags settings only apply to browser-based recording (learn more), and may be ignored for purposes of this tutorial.
The Car Rental Login window should be displaying john
as the User name (the default value). You will now define a check action for this value, and validate that the Password text box is enabled.
In the
Recording Lesson
test module you created previously, create a new test case:Place your cell pointer on a line somewhere below the existing set of action lines (but before the
FINAL
section, if any).Click Create New Test Case on the toolbar.
A test case line similar to the following is inserted.
In the second column of the new line, assign the test case an ID of
TC 02
(if not already set to that value).Optional: Press
Tab
to advance to the next column, and provide a description for your test case, such asRecording control checks
.
Select an empty cell within test case
TC 02
.Start the Action Recorder by clicking Record on the toolbar.
The Action Recorder panel appears in the lower right corner of the screen, , indicating recording mode is now in effect.
Use your mouse to drag the Action Recorder’s Check button to the User name text box in the Login window.
Your check action for verifying that User Name text box control has a value of john has now been recorded. (Note that no explicit confirmation of this is provided.)
Click Stop on the recording panel.
注意:If you have been practicing these tutorial lessons in sequence, your project should now have more than one interface entity defined for the Login dialog box. If that is indeed the case, you are presented with a dialog box informing you that More thanone interface entity matches the dialog
. To continue, select one of the interface entities – either should suffice.
Acheck
action such as shown below should now appear in your test case:The action checks the contents of the value property of the User name control, which is the value displayed by the control.
注意:Performing acheck
action on the value property is TestArchitect’s default check action for controls of type textbox, such as this one.Now return again to the Action Recorder Settings (select Tools > Action Recorder Settings…), and clear the Always use the default action when I define a control check check box:
In the editor, select an empty cell below the new action line, and again start the Action Recorder by clicking Record on the toolbar.
注意:Generally, we don’t start and stop the recording process when recording a sequence of action lines. We’re only doing that here in order to demonstrate the effect of changing the default check action setting.Use your mouse to drag the Check button to the Password text box in the Login window.
注意:Because of our change in the settings, the Check Action dialog box appears, enabling you to choose the property to be checked in the action you are about to create. In our case, we want to verify that this control is enabled, so select a Control property of enabled, with an Expected value oftrue
. Click Use.Click Stop on the recording panel.
注意:As before, you may be presented with a dialog box asking you to select an interface entity. And again, choose either one.Rather than a regular check action, the Action Recorder has created a
check control property
action. The property to be checked is the enabled property of the Password control of the Car Rental-Login window, and its expected value istrue
.
Your complete test case should now look something like this:
When executed, this test case can only pass if the value John
is displayed in the User name field, and the Password field is enabled.