Chapter 28. Case Study: A Library Print Server

“There’s no such thing as a free lunch.”

Anonymous

Here is a library print server system. Libraries use such a system to charge for printouts of documents. The example shows how acceptance tests can cover a workflow and not just a use case.


The Context

I have consulted for Rob Walsh, the cofounder of EnvisionWare, in exploring a new object design for the print server system the company provides to libraries. In my book Prefactoring, I showed the unit test strategy and underlying object design for the system.1 I described the work flow with a concentration on how it was implemented using the internal messaging system. The following workflow concentrates on the acceptance tests.

A library patron, Joe, wants to print a document created on one of the library’s computers. He submits the document for printing and then goes over to a release station to print the job. There are two separate use cases that form the work flow—submitting the document for printing and actually printing the document—. Internally, the personal computer and the release station communicate with a central server (see Figure 28.1).

Figure 28.1. Workflow

image

There are a number of tests that ensure the individual steps work. For example, some tests ensure that the print cost is correctly computed for various users and different modes of printing—black-and-white and color. Other tests check that users can deposit money into their prepaid accounts. The following is the test for the entire workflow.


A Workflow Test

In this workflow, Joe submits two documents for printing and then goes to the release station. When Joe signs onto the release station, he sees a list of the two print jobs. Joe selects each one to print. Each job is printed, and Joe’s account is charged. Here’s the detailed test.

Now two print jobs have been created. The next step in the flow is for Joe to go over to the release station and request each job to be printed.

Additional tests could show the flow if the user does not have sufficient money to print a document or the user decides to cancel the printing of a document.


Summary

• A workflow test consists of more than one use case.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.128.200.220