Professional Documents
Culture Documents
net/publication/228547568
Article
CITATIONS READS
21 2,208
3 authors, including:
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Jeff Offutt on 03 July 2014.
2
Motivation Understand the roles of different UML diagrams in test case generation.
Object Theory
Purposes Characterize the test cases that were generated from different
UML diagrams, and compare their fault revealing capability.
Perspective Researcher
Domain Project
Scope Single project
3.2. Independent and Dependent Variables Complete UML diagrams and implementation will be
provided in an accompanying technical report [2]. A high
Independent variables in this experiment are the types of level class diagram is shown in Figure 1. The cell phone
UML diagrams, the testing levels used, the criteria used to includes initialization of the system, making a call, an-
create tests, and the faults that are used at each testing level. swering a call, notification of an incoming call, and no-
Statecharts and sequence diagrams are used because they tification of an incoming text message. The cell phone
are intended to help developers describe software at differ- system in this experiment has eight classes. Five of the
ent levels of abstraction and because criteria for generating classes use state dependent design, hence, we have five
tests have previously been defined that easily be applied to state charts. They are UserInterface, HandsetCon-
these diagrams. The criteria based on statecharts are de- troller, NetworkInterface, Transmitter, and
signed to be applied during unit and module testing, and the Receiver. The functionalities of the cell phone are de-
criteria based on sequence diagrams are designed to be ap- scribed with six sequence diagrams with a total of 37 al-
plied during integration testing. These criteria are defined ternatives: Initialization, Making a call, An-
in Section 3.4. The faults are inserted by hand. swering a call, Notification of incoming
The dependent variables of the experiment are the two call, Notification of incoming text mes-
sets of test cases that are generated and the number of faults sage, and Turning off the cell phone.
found at each level using these test sets.
3.4. Generating Test Cases
3.3. Experimental Subjects
Test cases were generated by hand following previously-
For this experiment, we modeled the software for a stan- defined test generation techniques. To eliminate potential
dard cell phone. The experimental materials that needed for for bias, tests were not generated by the same person who
this experiment are the following: wrote the software and inserted faults. The test criteria used
1. Specification and design documents of the cell phone and process followed are detailed for each diagram below.
handset system. This includes a class diagram of six Sequence diagrams: In the UML, a message is a request
classes, five statechart diagrams, and six sequence dia- for a service from one UML actor to another, these is typi-
grams with 37 alternatives. cally implemented as method calls. Each sequence diagram
represents a complete trace of messages during the execu-
2. The implementation of the above specification and de- tion of a user-level operation. We form message sequence
sign, including eight classes of about 600 lines of Java paths by using the messages and their sequence numbers.
code. Message sequence paths can be traces of system level inter-
actions or component (object) level interactions. We de-
3. Test cases that are generated from the statecharts and fined the following coverage criteria for generating tests
sequence diagrams. There were 81 tests for the state- from sequence diagrams was defined elsewhere [1].
charts and 43 from the sequence diagrams. Message sequence path coverage: For each sequence
4. A collection of 49 unit and integration level faults, diagram in the specification, there must be at least one test
each of which was placed into a separate copy of the case T such that when the software is executed using T , the
program. software that implements the message sequence path of the
sequence diagram must be executed.
5. Unix shell scripts that run the test cases on each faulty The message sequence path coverage criterion is used
version of the implementation and records the result. to generate tests from the sequence diagrams. For each se-
3
Transmitter In this definition, “directly correlated” means that c con-
thread: Thread trols the value of P , that is, one of two situations occurs.
turnOn: Boolean
HandsetController
volume: Integer Either c and P have the same value (c is true implies P is
sample: AudioSample
ON: Integer=1 transmit: Boolean1 true and c is false implies P is false), or c and P have oppo-
OFF: Integer = 0
frame: UserInterface startTransmit()
stopTransmit()
site values (c is true implies P is false and c is false implies
packFrame: Boolean = true
networkInterface:
NetworkInterface
start()
turnOff()
P is true). This explicitly disallows cases such as c is true
UserInterface
networkStarted: Boolean
button: String
turnOn() implies P is true and c is false implies P is true.
phoneNumber: String 1 1
buttonPressed: String
cellPhoneOn: Boolean = false
availability: Integer * To satisfy the requirement that the test clause controls
message: String
main()
connectionLevel: Integer
incomingSignal: Integer
AudioSample the value of the predicate, other clauses in the predicate
getPhoneNumber() 1 1 deviceName: String
cellPhone: Integer
displayMessage() receiver: Receiver must be either True or False. For example, if the pred-
icate is (X ∧ Y ), and the test clause is X, then Y must be
clear() transmitter: Transmitter getSample(): String
actionPerformed()
*
setConnectinoLevel()
jbInit()
main()
HandsetController()
1 1
True. Likewise, if the predicate is (X ∨ Y ), Y must be
setPhoneNumber() buttonPressed() Receiver
UserInterface() talk() False.
start() thread: Thread
incomingCallArrived() turnOn: Boolean The original full predicate coverage criterion was based
textMessageArrived() volume: Integer
connectionLevelChanged() sample: AudioSample
1
on the notion of a predicate. The criterion considers tran-
timeout() transmit: Boolean
externalHangup() sitions that are triggered by change events with or with-
start()
1 startReceive() out other conditions that can be expressed in boolean ex-
stopReceive()
1 turnOff() pressions. However, UML statecharts have other types of
turnOn()
NetworkInterface
thread: Thread
events, call events and signal events. These events cannot
powerOn: Boolean
distance: Integer
be mapped directly into the existing full predicate testing
availability: Integer
random: Random
method. To generate test cases, we first find out what event
inComingSignal: Integer
connectionLevel: Integer
can trigger the starting transition of the statechart and under
start()
what conditions the event can be triggered. We then choose
stop()
run() values to cause that event to occur and to satisfy the condi-
makeConnection()
NetworkInterface() tions.
checkIncomingSignal()
endConnection() Test case generation for the cell phone application
connected()
timeout() yielded 81 test cases from statecharts, and 43 from sequence
diagrams.
4
version of the program is different from that of the original The primary threat to the validity of the experimental
program on the same input. That is, we used the original data is external, this is only one application and one set of
program as the “oracle”. The faults were kept in separate tests. Repetition of these results are needed in order to gen-
versions of the program to make bookkeeping easier (when eralize the results.
a failure occurred, it was clear which fault was found) and There were also several lessons learned during this ex-
to avoid interactions between faults such as masking. periment. One thing that became apparent is that UML stat-
echarts are not always sufficient for specifying low level
3.6. Experimental Procedure details, particularly when great precision is required. The
Object Constraint Language [15] can play a supplementary
The experiment was performed according to the follow- role for this purpose, and the integration of the OCL into the
ing steps. UML will provide better information for testing. Also, we
need to incorporate the previously unconsidered event types
1. Analyze and specify the cell phone handset system us- into the full predicate criteria for UML statecharts.
ing UML diagrams. The outcome of the specifica-
Another problem encountered during this experiment
tion and design include Class Diagrams, Statecharts,
was with concurrency. The expected execution trace
Collaboration/Sequence Diagrams, and Use Case dia-
that was developed from the sequence diagram sometimes
grams.
turned out to be different from the actual execution trace be-
2. Implement the system. cause of concurrency interactions. This could be a potential
problem in automating the testing process, and we proba-
3. Manually generate test cases from statecharts (81) and bly need to incorporate some concurrent testing approaches
sequence diagrams (43) to satisfy the testing criterion. [13, 14].
5
Number of Faults Faults Found by Faults Found by
Inserted Statechart TCs Sequence Diagram TCs
Unit
Faults 31 24 (77%) 20 (65%)
Integration
Faults 18 10 (56%) 15 (83%)