Creating Use Cases

A use case is a typical task that a user undertakes when working with the application under test. A use case must use the features of the application that require testing. It is essential that you only test features that are important and working properly. This is not the time to perform functional testing, which should already have been completed. Testing is a long process: the longer the use cases, the more time that will be required for testing.

When stepping through a use case, write down all significant screen events. For example, when entering a formula in Microsoft Excel you should document the changing of cells due to formula processing. Such events will translate into screen synchronizations that will be important during script development. Text synchronizations can be used for text-based screen synchronizations.

Document use cases to a detailed level. You need to document every mouse click, key stroke, and expected result. While this may be tedious initially, it makes things easier when you begin recording your test cases.

The following example, a test that simply locates an existing instance of Microsoft Word and opens a document, displays the level of detail that a use case should have. The square brackets (“[ ]”) indicate an event.

In the “Microsoft Word” window, navigate to the File menu and select Open….
[The “Open” dialog box opens] 
Select ‘Test.doc.’
Click Open.
[The “Open” dialog box closes]
[The “Microsoft Word” window has focus once again]

Note that the exact titles of the windows are documented in the above example. This becomes important later during script development as such information is needed to keep the script in sync with the application. Once you have a well documented use case, it is easy to script the application

There are several ways to write use cases. You can use XML notation, numbered notation, or another format that you are familiar with.

XML Use Case Example

<Task Name=”Open a document”>
  In the “Microsoft Word” window, navigate to the File menu  	  and select Open….
  [The “Open” dialog box displays]
  Select ‘Test.doc.’
  Click Open.
  [The “Open” dialog box closes]
  [The “Microsoft Word” window has focus once again]
</Task>

Numbered Use Case Example

100.01 – Open a document
  In the “Microsoft Word” window, navigate to the File menu  	  and select Open….
  [The “Open” dialog box displays] 
  Select ‘Test.doc.’
  Click Open.
  [The “Open” dialog box closes]
  [The “Microsoft Word” window has focus once again]
100.02
    …