Example Test Cases for the Find Dialog Box

If you want to test the Find dialog box, each test case would need to perform the following tasks:
  1. Open a new document file.
  2. Type text into the document.
  3. Position the insertion point at the top of the file.
  4. Select Find from the Search menu.
  5. Select the forward (down) direction for the search.
  6. Make the search case sensitive.

Non-Data-Driven Test Case for the Classic Agent

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.

Non-Data-Driven Test Case for the Open Agent

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()