Example of Linking a Test Plan to a Test Case

For example, consider the data-driven test case FindTest, which takes a record of type SEARCHINFO as a parameter:

type SEARCHINFO is record
   STRING  sText      // Text to type in document window
   STRING  sPos       // Starting position of search
   STRING  sPattern   // String to look for
   BOOLEAN bCase      // Case-sensitive or not
   STRING  sDirection // Direction of search
   STRING  sExpected  // The expected match

testcase FindTest (SEARCHINFO Data)
   TextEditor.File.New.Pick ()
   DocumentWindow.Document.TypeKeys (Data.sText + Data.sPos)
   TextEditor.Search.Find.Pick ()
   Find.FindWhat.SetText (Data.sPattern)
   Find.CaseSensitive.SetState (Data.bCase)
   Find.Direction.Select (Data.sDirection)
   Find.FindNext.Click ()
   Find.Cancel.Click ()
   DocumentWindow.Document.VerifySelText ({Data.sExpected})
   TextEditor.File.Close.Pick ()
   MessageBox.No.Click ()

The following test plan is associated with the FindTest test case. The testcase statement occurs at the Find dialog group description level, so that each of the test descriptions in the group can call the test case and pass a unique set of data to the test case:

Testplan FindTest.pln

Find dialog
script: findtest.t
testcase: FindTest
. . . .