This topic assumes that you are familiar with data driving test cases.
To thoroughly test an application feature, you need to test the feature with invalid as well as valid data.
For example, the sample Text Editor application displays a message box if a user specifies a search string in the Find dialog box that doesn’t exist in the document. To account for this, you can create a data-driven test case, like the following, that verifies that the message box displays and has the correct message:
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 STRING sMessage // The expected message in message box testcase FindInvalidData (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 () MessageBox.Message.VerifyValue (Data.sMessage) MessageBox.OK.Click () Find.Cancel.Click () TextEditor.File.Close.Pick () MessageBox.No.Click ()
The VerifyValue method call in this test case verifies that the message box contains the correct string. For example, the message should be Cannot find Ca if the user enters Ca into the Find dialog box and the document editing area does not contain this string.