TEST ADEQUACY CRITERIA FOR UML DESIGN MODELS
99
«requirement»
USE CASE: Successful Check out Copy
«requirement»
USE CASE: Unsuccessful Check out Copy
OVERVIEW: This Use Case specifies the behavior of a
successful copy check out.
OVERVIEW: This Use Case specifies the
behavior of an unsuccessful copy check out.
INPUTS: BORROWERID bid; COPYID cid; DATE currdate
INPUTS: BORROWERID bid; COPYID cid; DATE currdate
OCL Definitions (these definitions are used in the pre- and post-
condition sections of the Use Case):
OCL Definitions (these definitions are used in the pre- and post-
condition sections of the Use Case):
{let loancopy:Copy = copy->select(copyID=cid)
let borrower:Library Member =
{let loancopy:Copy = copy->select(copyID=cid)
let borrower:Library Member =
library Member->select(borrID=bid)}
library Member->select(borrID=bid)}
PRECONDITION:
PRECONDITION:
Overview: cid must identify an available copy
of a general book (i.e., a book whose copies can be checked out)
and bid must identify a library member.
Overview: cid does not exist, or has been checked or is a copy
of a reference book, or bid does not identify a valid library member.
OCL constraint:
OCL constraint:
{ loancopy->notEmpty() and borrower->notEmpty and
loancopy.status="available" and
{ loancopy->isEmpty() or borrower->isEmpty() or
( loancopy->notEmpty() and (loancopy.status="checkedout" or
loancopy.book.bookType="reference")) }
loancopy.book.bookType="general"
}
POSTCONDITION:
POSTCONDITION:
Overview: The library system is unchanged.
Overview: a link is created between the copy and the library member
the due date is set (14 days from current date) and the borrow date
is set to the current date.
OCL constraint:
{ library member=library Member@pre and copy=copy@pre and
book=book@pre and
copy.book=copy.book@pre and book.copy=book.copy@pre and
library Member.copy=library Member.copy@pre and
copy.library Member=copy.library Member@pre }
OCL constraint:
{ borrower.borrows->including(b) and b.IclIsNew() and
b.dueDate=currdate+14 and b.borrDate=currdate and
loancopy.status="checkedout"}
Figure 2. Use cases for checking out a copy.
2.2.2. Design model artifacts
A system is modelled as a collection of state machines that communicate asynchronously.
Three diagrams are used to describe different views of a system model: a DCD depicts the design
classes and their relationships, an activity diagram‡ describes the behaviour of class objects, and an
interaction diagram describes the intra-object communications. A design model consists of a DCD, an
activity diagram for each class in the DCD, and a set of interaction diagrams that present the object
interaction view of the system.
An example of a DCD that shows part of a design for the simple library system is shown in Figure 3.
The class Library Member is intended to realize the CM-Library Member concept (see Figure 1),
Copy is intended to realize the CM-Copy concept, while the class Borrows is intended to realize the
conceptual model association class Borrows. The other classes in the DCD represent design objects,
that is, objects introduced to support a particular implementation of the system. In this case, a System
‡
An activity diagram is a state machine in which actions take place in the states.
c
Copyright ꢀ 2003 John Wiley & Sons, Ltd.
Softw. Test. Verif. Reliab. 2003; 13:95–127