testcase FindTest () TextEditor.File.New.Pick () DocumentWindow.Document.TypeKeys ("Test Case<HOME>") TextEditor.Search.Find.Pick () Find.FindWhat.SetText ("Case") Find.CaseSensitive.Check () Find.Direction.Select ("Down") Find.FindNext.Click () Find.Cancel.Click () DocumentWindow.Document.VerifySelText (<text>) Case TextEditor.File.Close.Pick () MessageBox.No.Click ()
The major disadvantage of this kind of test case is that it tests only one out of the many possible sets of input data to the Find dialog box. To adequately test the Find dialog box, you must record or hand-write a separate test case for each possible combination of input data that needs to be tested. In even a small application, this creates a huge number of test cases, each of which must be maintained as the application changes.
testcase Find () recording UntitledNotepad.SetActive() UntitledNotepad.New.Pick() UntitledNotepad.TextField.TypeKeys("Test Case <LessThan>Home") UntitledNotepad.TextField.PressKeys("<Left Shift>") UntitledNotepad.TextField.TypeKeys("<GreaterThan>") UntitledNotepad.Find.Pick() UntitledNotepad.FindDialog.FindWhat.SetText("Case") UntitledNotepad.FindDialog.Down.Select("Down") Tmp_findNotepad.Find.MatchCase.Check() UntitledNotepad.FindDialog.FindNext.Click() Tmp_findNotepad.Find.Cancel.Click() Tmp_findNotepad.Find.Close()