Information Technology Reference
In-Depth Information
Fig. 2
Domain event specification example
fixture and a set of one or more test cases. A test case is a set of statements that
builds a state of the IB, and executes one or more test assertions. Figure
3
shows a
test program that consists of a fixture and two test cases (
confirmOrder
and
produc-
tKindsInCatalog
). CSTL also includes other constructs to make easier the task of
writing tests.
It is assumed that the execution of each test case of a CSTL program starts with
an empty IB state. With this assumption, the test cases of a program are independent
each other, and therefore the order of their execution is irrelevant. The fixture is a set
of statements that create an IB state and define the values of the common program
variables. It is assumed that each execution of a test case starts with the execution
of the fixture.
The basic construct of CSTL is the concrete test case. Each concrete test case has
a name and consists of a set of statements:
test
testName {
...
assert
...
}
The last statement of a concrete test case is an assertion, but in general there may
be several assertions in the same test case. The verdict of a concrete test case is
Pass
if the verdict of all of its assertions is
Pass
. The objective of the conceptual modeler
is to write test cases whose final verdict is
Pass
.
In CSTL there are five kinds of assertions, but in this chapter only two are used:
asserting the occurrence of domain events and asserting the contents of an IB state,
which we briefly describe in the following.
In CSTL, the instances of a domain event type
EventType
1
can be created with
the statement:
eventId:
=
new
EventType
1
(att
1
:
=
value
1
,..., att
n
:
=
value
n
,
r
1
:
=
participants
1
,..., r
m
:
=
participants
m
);
Search WWH ::
Custom Search