Anda di halaman 1dari 6

Test Cases Generation for Embedded Real-time Software Based on Extended UML

Yin Yongfeng, Liu Bin, Lu Minyan, Li Zhen


Dept. of System Engineering of Engineering Technology
Beihang University
Beijing, China
e-mail:{yyf,liubin,luminyan}@buaa.edu.cn, buaa011lz@163.com


AbstractAutomated testing of embedded real-time software is
a hotpot in nowadays software testing area. In this paper, the
relations between unified modeling language (UML) and
embedded real-time software testing are introduced firstly.
And then, based on the extensions of UML diagrams and the
scenario technology, we propose the test cases generation for
embedded real-time software based on extended UML.
Furthermore, combined with the verification of test cases
generation process for avionics embedded system, the research
thoughts and methods are brought out. The verification result
shows that the method proposed in this paper can be used
effectively in automated test cases generation of embedded
real-time software testing and improve testing efficiency and
maintainability so as to reduce the test cost.
Keywords-embedded real-time software; software testing; test
case; UML; scenario technology
I. INTRODUCTION
Software testing is an important method to assure
software quality. Traditional testing method based on
handwork is low efficiency and cause the increase of test
cost and time. Especially in embedded real-time software
testing, manual testing can not meet with the real-time
requirement and concurrency at all [1,9,20].
With the development of testing technology, it advances
high demand for software testing automation. The automated
test cases generation is viewed as a guarantee to carry out
effective and maintainable software testing [2,18]. At the
same time, the research on testing methods and tools for
testing automation have obtained a lot of importance
achievements such as the test cases modeling based on UCM
method[3], the automated communication protocol testing[4]
and the test cases generation based on scenario
technology[11,12,13]. As the UML has been popularly used
in the area of software engineering,the test cases generation
based on UML [5,6,7,8,9]is increasingly attached importance
to.
In this paper, we extend the UML class diagram,
sequence diagram and activity diagram in order to make
them meet the requirements of test case modeling. and
propose the model-based test cases generation method for
embedded real-time software testing. We also apply the
method to the test cases generation process for real avionics
embedded system to verify the correctness and effectiveness
of the method.
II. UML AND EMBEDDED REAL-TIME SOFTWARE
TESTING
A. UML Class Diagram and Embedded Real-time
Software Testing
As a commonly used diagram in object-oriented
modeling, class diagram shows the class, interface and the
relationships between them. In system requirements analysis,
class diagram is always used to describe the static structure
of system. Class diagram is the basis of constructing other
diagrams.
Generally, the run-time environment of embedded real-
time software is complex involving lots of crosslinked
devices and I/O interfaces. In embedded real-time software
testing, the class diagram is used to complete the static
modeling in test cases generation. Based on the analysis of
software under test (SUT), we use the extended class
diagram in modeling of SUT and its crosslinked devices by
object-oriented method.
The static modeling based on the class diagram is the
basis of follow-up dynamic modeling using activity diagram
and sequence diagram during the process of test cases
generation.
B. UML Activity Diagram and Embedded Real-time
Software Testing
Activity diagram uses the flow chart, state transition
chart and Petri network for reference to represent sequence
of fulfilling specific system functions or tasks.
To a complicated interactional and concurrent embedded
system, the core of testing work is to verify the operation
sequences of system. In this way, activity diagram is very
useful to embedded software testing.
For better describing the complicated functions of
embedded real-time system, we use layered activity
diagrams in system function modeling.
- The uppermost layer activity diagram is the main
work flow of SUT.
- The under layer activity diagrams expanded from
active nodes of the upper layer activity are used to
describe the sub-activity of SUT.
During the test cases generation, we need search activity
diagrams of all layers and extract all independent execution
paths for specific function from the starting node to the end
node.
2009 International Conference on Information Technology and Computer Science
978-0-7695-3688-0/09 $25.00 2009 IEEE
DOI 10.1109/ITCS.2009.23
70
2009 International Conference on Information Technology and Computer Science
978-0-7695-3688-0/09 $25.00 2009 IEEE
DOI 10.1109/ITCS.2009.23
70
2009 International Conference on Information Technology and Computer Science
978-0-7695-3688-0/09 $25.00 2009 IEEE
DOI 10.1109/ITCS.2009.23
70
2009 International Conference on Information Technology and Computer Science
978-0-7695-3688-0/09 $25.00 2009 IEEE
DOI 10.1109/ITCS.2009.23
70
2009 International Conference on Information Technology and Computer Science
978-0-7695-3688-0/09 $25.00 2009 IEEE
DOI 10.1109/ITCS.2009.23
70
2009 International Conference on Information Technology and Computer Science
978-0-7695-3688-0/09 $25.00 2009 IEEE
DOI 10.1109/ITCS.2009.23
70
2009 International Conference on Information Technology and Computer Science
978-0-7695-3688-0/09 $25.00 2009 IEEE
DOI 10.1109/ITCS.2009.23
70
2009 International Conference on Information Technology and Computer Science
978-0-7695-3688-0/09 $25.00 2009 IEEE
DOI 10.1109/ITCS.2009.23
70
2009 International Conference on Information Technology and Computer Science
978-0-7695-3688-0/09 $25.00 2009 IEEE
DOI 10.1109/ITCS.2009.23
70
2009 International Conference on Information Technology and Computer Science
978-0-7695-3688-0/09 $25.00 2009 IEEE
DOI 10.1109/ITCS.2009.23
70
2009 International Conference on Information Technology and Computer Science
978-0-7695-3688-0/09 $25.00 2009 IEEE
DOI 10.1109/ITCS.2009.23
70
2009 International Conference on Information Technology and Computer Science
978-0-7695-3688-0/09 $25.00 2009 IEEE
DOI 10.1109/ITCS.2009.23
70
2009 International Conference on Information Technology and Computer Science
978-0-7695-3688-0/09 $25.00 2009 IEEE
DOI 10.1109/ITCS.2009.23
69
2009 International Conference on Information Technology and Computer Science
978-0-7695-3688-0/09 $25.00 2009 IEEE
DOI 10.1109/ITCS.2009.23
69
The activity diagram can realize the micro description of
the test cases generation for embedded real-time software.
C. UML Sequence Diagram and Embedded Real-time
Software Testing
In test cases generation, activity diagram realizes the
micro description of the system work flow, but the activity
diagram can not describe the details of the interaction
process between objects, for example, the data
communications and message passing. Using sequence
diagram, we can see all the details of the interactions in
certain time segment because the basic element of sequence
diagram is time.
From above, we can see that sequence diagram is very
suit for describing time and time constrains in embedded
real-time software testing .In this case, we can use sequence
diagram to describe the details of the dynamic interaction
process during the test cases generation.
The sequence diagram can realize the microscopic
description of the test cases generation for embedded real-
time software.
III. RESEARCH ON EXTENSION OF UML FOR TEST CASES
GENERATION
A. Extension of Class Diagram
For realizing the static modeling of test cases generation
for embedded real-time software, we need to extend the class
diagram. By defining the new stereotype on class and
association, we get the solution to extend the class diagram.
- Adding the <<Block>> stereotype. In general, the
data transferring between the embedded devices is
through the data bus and the data transfer protocol is
varied. In this case, we add the <<Block>>
stereotype to describe the I/O bus data transferring.
- Adding the <<Device>> stereotype. We use the
<<Device>> stereotype to realize the modeling of
SUT and its crosslinked devices. As show in the
figure 1, SUT and its crosslinked devices all can be
derived from <<Device>>.
- Adding the <<Link>> stereotype. We use the
<<Link>> stereotype to describe the I/O links
between embedded devices. The added tagged
values which are used to describe the data transfer
protocol are as follows.
Link.TransType = value //data type
Link.SrcDevice = value // source device
Link.DesDevice = value //target device
To sum up, Figure 1 shows the framework for the
modeling of SUT and its crosslinked devices based on the
extension of class diagram.
Figure 1. The framework for SUT and its crosslinked devices modeling
B. Real-time Extension of Activity Diagram
Though activity diagram has strong ability to describe the
work flow of system, it is not specific to embedded real-time
software testing field. To realize the dynamic modeling of
test cases generation, we should solve two basic problems
below.
- Clock. Activities of embedded real-time system are
closed related with time, so its necessary to record
all time characteristics of activities during the test
process. In this paper, as we used the layered activity
diagrams, we introduce global clock and local clock
to decrease the difficulties of modeling and reduce
coupling between activities in different layers.
Global clock is used to record the time of the
activities in the uppermost layer diagram. Local
clock is used to record the time of the under layer
activities. We can get the global clock of all under
layer activities through the local clock by the defined
rules.
- Activities constrained by time. We introduce timer
service which uses triggers to starting, suspending
and stopping specific activities to describe the
activities constrained by time during the test cases
generation.
In this paper, we use the real-time extension of activity
diagram to realize the dynamic modeling of test cases
generation. The methods we use in extension are as follows.
We add time labels to the description of actions in
activity diagram as a supplement of attributes of action.
Def. 1: Atomic Function. The function cant be
decomposed and is determined and linear once being
executed.
Def. 2: Combined Function. The function can be
decomposed.
Def. 3: <<Task>> and <<CombinedTask>> Stereotype.
<<Task>> stereotype is used to describe the atomic function
in activity diagram, while the <<CombinedTask>>
stereotype is used to describe the combined function. Besides,
we add tagged values to extend above two stereotypes.
- To <<Task>> stereotype, we use sequence diagram
to describe the activity because the execution of
atomic function is determined and linear. The
definitions of added tagged values are as follows.
71 71 71 71 71 71 71 71 71 71 71 71 70 70
Task.ID = value //unique identification
Task.Period = value //period of task,0 means
timing
Task.StartTime = value//start time
Task.EndTime = value //end time
Task.Priority = value// priority
Task.Action={SequenceDiagram1}
//the activities described by sequence diagram
- To <<CombinedTask>> stereotype, we use use
layered activity diagrams to describe the activity
because the combined function can be decomposed.
The definitions of added tagged values are as
follows.
CombinedTask.ID = value //unique identification
CombinedTask.Period = value //period of task
CombinedTask.StartTime=value//start time
CombinedTask.EndTime=value//end time
CombinedTask.Priority = value// priority
CombinedTask.Action={ActivityDiagrams}
//activities described by layered activity diagrams
Def. 4: Time Delay. In activity diagram, we use [Wait.
time = value] to describe constrain condition of time delay.
Time delay is a null operation in fact and can be viewed as a
waiting state. We define the time unit as millisecond owing
to the reaction of embedded system is mainly in milliseconds.
Figure 2 shows that the activity b starts after c milliseconds
when the activity a finished.
Figure 2. The description of time delay
Def. 5: Conditional Jump. During the testing process,
some activities only can be activated when the previous
activity is over and specific conditions have been satisfied.
We use the method of adding conditional expression
[Condition:Expression] on activity transfer to describe the
conditional jum. In test cases generation, the conditional
expression can be used as the precondition or post-condition
of activities as showed in figure 3.
Figure 3. The description of conditional jump
As UML is absence of precise and formal semantic
definition and is not favorable to the automated testing
modeling, we give the formal definition of extended activity
diagram as shown in Def.6.
Def. 6: Formal Definition of Activity Diagram(AD).
) , , , , , , , , (
F I
a a P Lct Ect G F T A AD = :
} ,..., , {
2 1 m
a a a A = : a set of finite states of activities;
} ,..., , {
2 1 n
t t t T = : a set of finite transfer;
) ( ) ( A T T A F _ : a flow of relation between A and
T ;
) (t G : a condition expression of T ;
Ect , Lct : mapping from A to natural number set N
) ( N A . It shows the earliest and latest time of an
activity and satisfies the condition of
) ( ) ( a Lct a Ect s , A a e , 0 ) ( =
I
a Ect and 0 ) ( =
I
a Lct ;
P : priority of an activity, ) (a P ={0,1,2} representing
the low, normal and high state;
A a
I
e , A a
F
e : the start and end activity state which
satisfy the condition of T t e ' and F a t
I
e ' ) , ( .
C. Real-time Extension of Sequence Diagram
As the supplement of activity diagram, sequence diagram
has good capability to describe the data interaction process
between test objects in embedded real-time testing. For more
effectively describing the time and data characteristics of the
interaction process, we proposed the real-time extension of
sequence diagram.
Def. 7: <<Transfer>> Stereotype. We use the
<<Transfer>> stereotype which can be use in the process of
message passing and function calling to describe the data
transfer between SUT and its crosslinked devices in
sequence diagram. Besides, we add the tagged values to
describe the data transfer protocol.
Transfer.sndr = value //source device
Transfer.rcvr = value //target device
Transfer.cond = expression//transfer condition
Transfer.time = value //transfer time
Transfer.type = value //type of interface
Transfer.para_lst = value // parameter list
From above, the transfer condition and transfer time can
be viewed as the constraint of transfer. In addition, we
extend constraint of message as showed in figure 4 to
describe the interaction process.
Figure 4. The description of interaction between test objects
The formal definition of extended sequence diagram are
showed in Def.8.
Def. 8: Formal Definition of Sequence Diagram(SD).
) , , , (
F I
M M M O SD = :
O: objects set which is finite and not empty;
} ,..., , , {
3 2 1 n
m m m m M = : a finite set of messages and
satisfy the condition that as follows:
_ _
i
m time guard m name parameter list = ,
time: time of message transfer,
guard: condition of message transfer,
m_name: name of message transfer,
parameter_list: parameters of message,
return_value: return value of message,
sendereO: the sender of M,
receivereO: the receiver of M;
I
M and
F
M :the start and the end events.
72 72 72 72 72 72 72 72 72 72 72 72 71 71
IV. THE PROCESS OF TEST CASES GENERATION WITH
CASE STUDY
A. General Introduction of the Process of Test Cases
Generation
The figure 5 shows the process of test cases generation
which includes static modeling, dynamic modeling,
searching and extracting testing scenario and generation of
formal description of test cases.
Combined with the test cases generation process for
avionics inertial navigation system (AINS), the research
thoughts and methods will be the verified.
Figure 5. The process of test cases generation
B. Static Modeling
Based on the extension of the class diagram, the process
of static modeling for SUT and its crosslinked devices are as
fallows.
- The SUT and its crosslinked devices should be
identified and distinguished firstly by analysis of the
documents of SUT. And then, we can derive the
subclasses from the ESDevice class and give the
identification of the devices according to their names.
- According to need of data transferring between
devices from the documents, we should add
properties and methods for subclasses and fulfill
their configuration, for example, the configuration
and operation of interface variables.
- According to need of connection relations between
devices from the documents, we should established
those connections and fulfill their configuration.
Figure 6 gives the static modeling for AINS and its
crosslinked devices.
Figure 6. The static modeling for AINS and its crosslinked devices
C. Dynamic Modeling
1) The Combined Function Modeling Based on Activity
Diagrams
In dynamic modeling of test cases generation, the layered
activity diagrams are used to describe the combined
functions. The activity diagram contains information
including doing what, when and where the activity will take
place.
The process of dynamic modeling with real-time
extended activity diagrams is as fallows.
- Getting function list of SUT and the relations
between function modules based on analysis of
software documents.
- Building uppermost layer activity diagram to
describe main work flow of SUT and label those
functions which can be decomposed to combined
activity nodes.
- Building under layer activity diagrams for those
combined activity nodes and decomposing them into
sub-activity diagrams until all the sub-activity
diagrams can be described in atomic functions.
- Acquiring time and other attributes of function
points and marking them in activity diagram.
- Adding condition expression in activity diagram as
fallows:
o Condition judgment: every judgment
should have one entrance migration and
two exit migration. The corresponding
logic expression should be indispensable.
o Loop structure: a special condition
judgment which allows adding the max
loop time.
o Concurrence structure: configure
minimum and max concurrency as a
control.
- Precondition and post-condition: allow adding
condition expression of the occurrence of activity.
Figure 7 gives the uppermost layer activity diagram of
system functions for AINS.
Figure 7. The uppermost layer activity diagram of system functions
2) The Atomic Function Modeling Based on Sequence
Diagram
Using the real-time extended activity diagrams, we can
get all atomic functions of SUT. As discussed above, we use
the sequence diagram to realize the microscopic description
73 73 73 73 73 73 73 73 73 73 73 73 72 72
of all details of atomic functions for test cases generation.
Figure 8 gives the interaction process between test objects in
one of atomic functions of AINS.
Figure 8. The interaction process in one of atomic functions of AINS
D. Searching and Extracting of Testing Scenario
Def. 9: Test Scenario. Test scenario is a path extracted
independently from start node to end node for describing
specific function of system.
In order to realize the test cases generation, we need
search all layers of activity diagrams and extract all test
scenarios. During the process of extracting test scenarios, we
should choose some value in the input data domain aiming at
every input operation in test scenarios, at the same time, we
also should get the expect output from the analysis of
documents of SUT.
The algorithm of test scenarios generation is as follows.
- Firstly, we should set a stack to save the information
of the nodes and migrations of test scenario and set a
hash table to save the accessed migrations
information which is started from some decision
node in the activity diagram.
- Secondly, we find the start node and copy it into the
test scenario and save the current node to the stack
which will be marked as NODE_A.
- And then, we should check the migration
information from NODE_A. There exist two cases
for target node which will be marked as NODE_B.
o If the target node (marked as NODE_B) is
a decision node, we should mark the
accessed label of NODE_B as TRUE. To
the next, we should choose a no-accessed
path from decision node and mark the new
target node as MODE_C. Now, we have
got the migration (NODE_A->NODE_B-
>NODE_C) which will be copied into the
test scenario and we should save all
information of these nodes to stack.
Following that, we should copy the
migration (NODE_B->NODE_C) into the
hash table and mark the current node
(NODE_C) as NODE_A.
o If the target node (marked as NODE_B) is
not a decision node, we should copy the
migration (NODE_A->NODE_B) into the
test scenario and save all information of
the two nodes to stack and mark the
current node (NODE_B) as NODE_A.
- Furthermore, the above step should be repeated until
the end node is accessed. With popping up all
information of nodes and migrations in turn from the
current stack top to bottom, we will complete the
extraction of one test scenario.
- With repeating above steps, we can get all test
scenarios.
E. Formal Description of Test Cases
Based on the test scenarios we have got and the static and
dynamic information of the nodes, we can generate the
formalized test cases which are described with XML. Table
1 shows the formal description of test cases of AINS based
on one test scenario.
TABLE I. FORMAL DESCRIPTION OF TEST CASES
V. CONCLUSION AND FUTURE WORK
In this paper, we introduced UML modeling technology
and scenario technology into the software testing field and
proposed the test cases generation for embedded real-time
software based on extended UML. We applied the method
proposed in this paper into the test cases generation of
avionics embedded system and the correctness and validity
of the method are validated.
We plan to further improve real-time extension of UML
diagrams to satisfy the requirements of generality and
expansibility. At the same time, we will optimize the
algorithms of automatic test cases generation.
ACKNOWLEDGMENT
We owe our thanks to the department of system
engineering of engineering technology of Beihang university
for this research project.
REFERENCES
[1] Lin Bin, Gao Xiaopeng, Lu Mingyan, Ruan Lian, Study on Reliability
Simulation Software System for Embedded Software[J], The Journal
of Beijing University of Aeronautics and Astronautics, 2000.
[2] Yin Yongfeng,LiuBin,Lu Minyan,Research on Test Script for
Embedded Real-time Software[J], Computer Engineering,
2003,vol.29,No.1, pp.118-119.
<TestCase name="TestCase001">
<Task ID="Task1">
<TaskProperty>
<Parameter name="StartTime"
type="int" value="1000"></Parameter>
<Parameter name="EndTime"
type="int" value="2000"></Parameter>
<Parameter name="Priority"
type="block" value="0"></Parameter>
<Parameter name="Period"
type="float" value="23.5"></Parameter>
</TaskProperty>
<TaskAction>
<Action time="1500"
condition="NULL" SrcObj="DCMP"
DesObj="AINS" VarName="DCIN_01"
length="4"value="0FBA"></Action>
<Action time="1500"
</Action>

</TaskAction>
</Task>
<Task ID="Task2">.

</Task>
</TestCase>
74 74 74 74 74 74 74 74 74 74 74 74 73 73
[3] Andrew Miga,Daniel Amyot,Francis Bordeleau,Donald Cameron,and
Murray Woodside, "Deriving Message Sequence Charts from Use
Case Maps Scenario Specification"[J], Carleton University,2001.
[4] Michael Ebner, TTCN-3 Test Case Generation from Message
Sequence Charts[J]Telematics Group, Institute for Informatics,
Georg-August- University, Germany.
[5] Huang Chenhui, Research on Automatic Web Function Test
Technique Based on UML Activity Diagram[D], JiNan University,
May . 2005.
[6] Mou Kai, Gu Ming. Research on Automated Test Case Generation
Based on UML Activity Diagram[J]. Computer Applications. April
2006, 26(4), pp.844~847
[7] Zhang Mei. Research on Automated Test Case Generation Based on
UML Activity Diagram Model[J]. The Journal of Beijing University
of Aeronautics and Astronautics, Aug 2001.vol.27, No.4.
[8] Chen Biquan. Research on Test Case Generation Based on UML
Statement Diagram Mode in Embedded Real-time Software
Testing[D]. JiNan University , May 2005.
[9] Yang Xiaoyan, Research on Test Case Generation Based on Z and
UML Status Diagram[D], HuaZhong Normal University, Jun 2006.
[10] James Rumbaugh, Ivar Jacobson, Grandy Booch, The unified
modeling language reference manua[M]. An imprint of Addison
Wesley Longman Inc, 1998.
[11] Tsai, W.T.; Na, Y.; Paul, R.; Lu, F.; Saimi, A.; Adaptive scenario-
based object-oriented test frameworks for testing embedded systems.
Computer Software and Applications Conference, 2002. COMPSAC
2002. Proceedings. 26th Annual International,26-29 Aug. 2002,
pp.321 - 326
[12] Bai, X.; Tsai, W.T.; Paul, R.; Feng, K.; Yu, L.;Scenario-based
modeling and its application. Object-Oriented Real-Time Dependable
Systems, 2002. (WORDS 2002). Proceedings of the Seventh
International Workshop on 7-9 Jan. 2002, pp.253 - 260
[13] Tsai, W.T.; Yu, L.; Saimi, A.; Paul, R.;Scenario-based Object-
Oriented Test Frameworks for Testing Distributed Systems.
Distributed Computing Systems, 2003. FTDCS 2003. Proceedings.
The Ninth IEEE Workshop on Future Trends of 28-30 May 2003,
pp.288-294
[14] Cavarra. A method for the automatic generation of test suites from
object models.Information and Software Technology, vol.46, 2004.
pp.309314.
[15] Ingo Schinz, Tobe Toben,Christian Mrugalla,Bernd Westphal.The
Rhapsody UML Verification Environment.SEFM2004, 0-7695-
2222-X/04.
[16] OMG. Unified Modeling Language Specification(Version1.5)[Z].
[17] Yi Zhenyan,System Analysis,Design and Application Case Based on
UML(Ver 1.0). People's Post and Telecom Press. Beijing. 2003.
[18] Jiang Bo, Long Xiang,Gao Xiaopeng. MobileTest: A Tool Supporting
Automatic Black Box Test for Software on Smart Mobile Devices.
Proceedings of the 30th International Conference on Software
Engineering (ICSE 2007).
[19] Ammann, P.; Black, P.E.;Abstracting formal specifications to
generate software tests via model checking. Digital Avionics Systems
Conference, 1999. Proceedings. 18th vol.2, 24-29 Oct. 1999
pp.10.A.6-1 - 10.A.6-10.
[20] Michael Levesque, John Louie ,Ana Maria Guerrero.Test Execution
Control Tool: Automating Testing in Spacecraft Intgration and Test
Environments. IEEE, 2000, vol.2, pp.293 -304.
75 75 75 75 75 75 75 75 75 75 75 75 74 74

Anda mungkin juga menyukai