The Integrated Application Based on Real-time Extended ... - CiteSeerX

2 downloads 1176 Views 446KB Size Report
into the real-time embedded software testing field and a real-time .... A kind of state to connect more than one state transition or divide a conversion into a section ...
1410

JOURNAL OF NETWORKS, VOL. 5, NO. 12, DECEMBER 2010

The Integrated Application Based on Real-time Extended UML and Improved Formal Method in Real-time Embedded Software Testing Yongfeng Yin1,2, Bin Liu1,2, Zhen Li1, Chun Zhang2, Ning Wu2 (1. School of Reliability and System Engineering, BeiHang University) (2.Software Reliability Management and Testing Center of Aviation Industry Corporation of China) Beijing, China Email: {yyf, liubin}@buaa.edu.cn, [email protected], [email protected], [email protected]

Abstract—In this paper, formal methods were introduced into the real-time embedded software testing field and a real-time extended finite state machine, called rt_EFSM, was studied firstly. And then, the process of the integrated application based on real-time extended Unified Modeling Language (UML) and improved formal method in real-time embedded software testing are put forward. Furthermore, the extension scheme of the real-time UML, including the improvement and extension of state transitions and time constraints described mechanism, and the conversion method from real-time UML to rt_EFSM ware proposed. Finally, combined with the testing process of flight control software of an unmanned aerial vehicle (UAV), a method to generate the time-extended UIO sequence (ex_UIO) was put forward. Finally, the method to generate test cases automatically according to ex_UIO sequence was brought forward. The method proposed in this paper can fully make use of the advantages of tool resources of the UML which has been as the industry standard, but also the advantages of formal methods in accuracy, effectiveness and automation support. Index Terms—software testing; UML; formal method; realtime embedded software; EFSM; test case; test sequence

I.

INTRODUCTION

With the development of computer technique, the realtime embedded software has been widely applied in modern weapons and equipment system, especially in fields of aeronautics and astronautics. How to guarantee the quality and reliability is an important problem in this field. Software testing has been always proved an essential approach [1][2] of assurance. Owing to the increase of scale and complexity of software, both industry and academic believe that formal method is an effective solution [3] to software testing. Nowadays there are more and more formal methods applied in software testing and verification, such as control flow-based testing method [4] used to directly generate test sequences originated from the formal model, data flow-based testing method [5] used to generate test *The project was supported by the Aviation Science Aviation Science Foundation of China (20095551025).

© 2010 ACADEMY PUBLISHER doi:10.4304/jnw.5.12.1410-1416

sequence from the EFSM or Petri net reachability graph and the combination of two methods above, etc. Reference [7] proposed an embedded software testing method based on an assertion-based EFSM extension model of p-EFSM. Reference [8] proposed a time-extended finite state machine, used to describe the characteristics of the system modeling with time. A reactive system-oriented testing method based on both state charts and temporal logic is demonstrated in Reference [9], and functional testing methods, combined with hardware architecture and based on EFSM model along with fault injection in Reference [10]. UML is an Object-Oriented and general-purpose graphical modeling language. It has been widely used in software engineering and has become an industry standard, and is gradually introduced to the field of software development and testing, such as the test method based on UML state diagram[13][14], activity diagram[15] , sequence diagram[16][17] and combining a variety of diagrams[20]. UML state diagram, as the extension of the finite state machine, emphasizes the modeling of complex real-time system and provides mechanisms such as the description of concurrency, so more and more used in the field of real-time embedded software testing. However, as a non-formal language, in describing the real-time and other characteristics of embedded software, UML can not be directly applied to automatic test of embedded software. In addition, as a constraints language of UML model element, the Object Constraint Language (OCL) can describe the static and dynamic behavior of the system under test well and dynamic behavior, such as preconditions, monitoring conditions, variables and so on, thus gradually introduced the testing field of embedded software[18][19]. Based on the existing formal methods especially the time-extended EFSM[11][12], this paper put forward a real-time embedded software test case generation based on time-extended EFSM, called rt_EFSM, the extension scheme of the real-time UML and the conversion method from real-time UML to rt_EFSM. Finally, the method is used in testing of flight control software of UAV.

JOURNAL OF NETWORKS, VOL. 5, NO. 12, DECEMBER 2010

II.

REAL-TIME EXTENDED EFSM

The traditional EFSM model is a six-tuple : S: non-empty set of finite states; S0: the initial state; I: non-empty finite set of input; O: non-empty finite set of output; T: non-empty finite set of transition; V: non-empty set of variables The traditional EFSM model is lack of the ability to describe the complexity and real time characteristic for Real-time embedded software. It can not meet the requirements of testing for real-time embedded software. Based on the analysis above, we proposed the real-time extended EFSM model for real-time embedded software and extend the EFSM as an octet. The real-time extended EFSM, rt_EFSM=,where: S: non-empty set of finite states; S0: the initial state; I: finite set of input; O: finite set of output; T: non-empty finite set of transition; and T=[8]; and Head(t) is the start state of transition; I(t) is the input message included in set I; P(t) is the precondition of transition t and it could be empty; operation is the operation during transition process, usually it includes assignment statement and output statement; O(t) is the output message included in set O; Tail(t) is the end state of transition; TM is transition time, which is triple as , tf indicates that the transition time is a fix time, tF indicates that the transition time is a stochastic time complies to some distribution function; tI indicates that the transition time is a time interval; V: non-empty set of variables, and V=; IV is the set of input variables, and they are under tester’s

1411

control; OV is the set of output variables; CV is the set of environment variables, which can be local variables or global variables, and the variables that are neither input variables nor output variables can be called environment variables; both CV and OV are out of the tester’s control, their values are decided by state transition operation. C: the set of static information of each state, C=, and NAME(S*) is state label, Variable(S*) is the related variable to the state ; Action(S*) is the action and activity of the state. III. THE PROCESS OF THE INTEGRATED APPLICATION BASED ON REAL-TIME EXTENDED UML AND IMPROVED FORMAL METHOD When rt_EFSM is applied to complex real-time embedded software modeling, it often faces state explosion because the model can not support the syntax hierarchy. Although the state space can be decomposed according to the system structure, it maybe affects the system integrity. As the extension of finite state machine, UML state diagram is a graphical modeling language and provides level mechanisms such as the description of concurrency which has gradually been introduced to the real-time embedded software testing field. UML state diagram can be expressed as: UML state diagram = FSM + nested + concurrent + broadcast mechanism In this paper, the modeling method based on real-time extended UML is proposed and the conversion method from real-time UML to rt_EFSM is also brought forward. Figure 1 gives the process of the integrated application based on real-time extended UML and improved formal method in real-time embedded software testing.

Figure 1. The Integrated Application Based on Real-time Extended UML and Improved Formal Method

IV.

CONVERSION FROM STATE DIAGRAM TO RT_EFSM

A. The Real-time Extension of the UML State Diagram 1) The improvement and extension of state transitions When we use UML state diagram to describe the dynamic behavior of the software under test (SUT), the

© 2010 ACADEMY PUBLISHER

functions are carried out by traversing along the state diagram and receive events and perform the conversion completed. The state transition can be defined as: event-trigger(parameters)[guard]/action list • event-trigger is the event to trigger state change which composes the identity of conversion events together with the parameter list;

1412

JOURNAL OF NETWORKS, VOL. 5, NO. 12, DECEMBER 2010

• guard is a Boolean expression and the conversion will be undertaken when its value is true • action list will be executed as the result of state transition and these operations will act on some object. 2) The Improvement and Extension of State TABLE I. No.

During the test modeling process based on UML state diagram, we need to improve and extend states in order to make them a better expression to describe the dynamic behaviors of SUT. In order to better describe SUT, 'pseudo-state', as described in Table1, was added in UML state diagram.

THE DESCRIPTION OF PSEUDO-STATES

Pseudo-state

Description A set of possible target states, at most only one 'OR' state will be activated under the guard condition. A kind of state to connect more than one state transition or divide a conversion into a section of continuous conversion A kind of connection state to which can combine multiple incoming converted into or create a state of transition, especially when the number of different events triggered by the conversion of an action list and (or) guard condition. A kind of conversion before entering the next connection to the implementation of its action list. The state allows a conversion action is bound to paragraph so that they can follow-up care before the implementation of the assignment expression

1

Branch

2

Connection

3

Merger Connection

4

Selection

5

AND composite state

A kind of state which can be concurrent active at the same time with other states

6

OR composite state

A kind of state which can not be concurrent active at the same time with other states

7

Broadcast Event

A state that all of the other states received the same event

8

Communication event

A state that the results are sent out after the state transition

9

IS_IN() operator

The parameters in parentheses is some state and that means the use of the operator is in that state

3) The Introduction of Time Constraints Described Mechanism In real-time embedded software testing, there are generally time-related events, namely the timing of events and the time has very strict requirements, while the original UML state diagrams can not provide above described mechanism. In this paper, we use OCL constraints to provide a time constraint describe mechanism. • Time-out event constraint is maintained in a state only in a limited time, overtime, the system switch to another state. Figure 2 shows that the system is in State1 in the overtime period, overtime, the automatic conversion to State2.

• Conversion with time constraint means that the state transition can only occur in a certain time period. Figure 4 shows that the state transitions will be occur after 1000 clock cycle.

Figure 4. Conversion with time constraint

• Periodic event constraint refers to some operations are performed periodically. Figure 5 shows that the State2 automatically convertes to State1 in every 100ms, a total of 5 times.

Figure 5. Periodic event constraint

Figure 2. Time-out event constraint

• Operation time delay constraint refers to require to delay some time in the operation of state transition. Figure 3 shows that the SendData( ) operation should delay 200ms before execution in state transition.

Figure 3. Operation time delay constraint

© 2010 ACADEMY PUBLISHER

B. The Conversion Method from Real-time UML to rt_EFSM From the definition of UML state diagram, we can see that the difference between UML state diagram and rt_EFSM includes the level, concurrency and broadcast. Therefore, he conversion from real-time UML to rt_EFSM must eliminate the level, concurrency and broadcast. The conversion methods are as follows. Let States and Trans respectively describe the finite set of the states and transitions in UML state diagrams. For a state transition t ∈ Trans, we use the source(t) and target(t) to respectively describe the set of the source state and

JOURNAL OF NETWORKS, VOL. 5, NO. 12, DECEMBER 2010

destination state and use the event(t), guard (t), action(t) and send(t) to describe the parts of that state transition. Let the rt_EFSM converted from UML state diagram be a triple Structure: < Gstates, C0 ,Gtrans >, where Gstates is the set of global states, C0 is the initial state, Gtrans is the set of global transitions. 1) Construction of Global States The largest set of states in a system is called a global state, denoted by GS, and the GS ∈ States, and to meet: • root ∈ GS • for each AND composite state s, s and its all substates are in GS or they are not in GS; • for each OR composite state s,s and one of its substates are in GS or they are not in GS; From the characters of GS, the steps to obtain GS are as follows: • Obtain the state tree from state diagram: 9 Regards the root state of the state diagram as the root state of the state tree; 9 Using the breadth-first method to search the state diagram and regard their sub-state as the children nodes of the root; 9 Continues to operate above step until no child nodes 9 Improve the relationship of the brother nodes in state tree, which means that if the state tree, the brothers, or the state of relations between, you do not change; if the brothers is the relationship with the state, will in which a brother and all of its children nodes as another brother, all leaf nodes of children. • Search UML state diagram of all states, to find root state; • Start from the root state, we can use the depth-first method to search all the states, if the state Si is a leaf node, it serves the node and all of its parent state together as a rt_EFSM in GS. 2) Construction of Global Transitions Let GS as the global state, e as a trigger event and T

∈ Trans as the state transition. If the state transitions t ∈ T, and source(t) ∈ GS, event(t)=e, and the transitions in T are not conflict, we define that the T is the maximum transition set triggered by e in GS. The global transitions in rt_EFSM can be defined as a five-tuple: GT = AC AC->IC MA->AC AC->MA CRC->AC AC->CRC HRC->AC AC->HRC CRC->HRC HRC->CRC IC->HRC IC->CRC IC->HRC IC->CRC MA->HRC MA->CRC MA->HRC MA->CRC IC->MA

C. Test Case Generation In order to generate the final executable test case, the input variables and methods of test sequence must be instantiated to ensure the state transition which meets the pre-conditions after the test sequence above has been generated. This paper will transfer the test sequence to

TRANSFORM RULES OF OPERATION EXPRESSION

Test Sequence

Operation Expression

r

DO Reset the rt_EFSM

Back to initial state

A1

SEND A1;

Send A1 as into state IC

SEND A2;Vg=X;

Send A2 as into state IC and set flight speed(Vg) in next period to X

B1

SEND B1;

Send B1 as into state AC

B2

SEND B2;

Send B2 as into state MA

C1

SEND C1;

Send C1 as into state CRC

C2

SEND C2;

Send C2 as into state HRC

X

X=X>100?100:X

Flight Speed-X

(A2,X)

Explaination

Based on above transfer rules, we should convert the test sequences into the corresponding operation expressions which will be used to create test cases. We have developed conversion program to complete these factions as shown in Figure 8.

Figure 8. The Flow Chart of Conversion Program

VI.

CONCLUSIONS

Formal method has become an important mean for modeling and testing the real-time embedded software. In

© 2010 ACADEMY PUBLISHER

this paper, formal methods were introduced into real-time embedded software testing field and the formal definition of real-time extended EFSM (rt_EFSM) was studied. And

1416

JOURNAL OF NETWORKS, VOL. 5, NO. 12, DECEMBER 2010

then, the process of the integrated application based on real-time extended UML and improved formal method is put forward and the extension scheme of the real-time UML is also brought forward. Finally, combined with test cases generation of the flight control software of UAV, rt_EFSM was applied and the formal definition of timeextended UIO sequences (ex_UIO) was given. Meanwhile, the method to generate the ex_UIO sequence and the test cases were brought forward. The application validates the correctness and validity of the method proposed in this paper. At the same time, the method proposed in this paper can fully make use of the advantages of tool resources of the UML which has been as the industry standard, but also the advantages of formal methods in accuracy, effectiveness and automation support. ACKNOWLEDGMENT We owe our thanks to the anonymous reviewers and School of Reliability and System Engineering of BeiHang University. REFERENCES [1] Jiang Bo; Long Xiang; Gao Xiaopeng;MobileTest: A Tool Supporting Automatic Black Box Test for Software on Smart Mobile Devices. Automation of Software Test [C], 2007. AST '07. Second International Workshop on 20-26 May 2007, Page(s):8 - 8 [2] Yin Yongfeng, Liu Bin, Zhong Deming, Jiang Tongmin. On Modeling Approach for Embedded Real-time Software Simulation Testing[J]. Journal of Systems Engineering and Electronics.Vol.20,No.2,2009, Page(s):420-426 [3] Ye Xinming. A Survey on the Methodology Integrating Formal Verification and Conformance Testing[J]. Journal of Inner Mongolia University. Vol.40, No.4, 2009, Page(s):486-492 [4] Li hua, Ye Xinming. Gnerating Executable Test sequences based on petri-net for combined control and data flow of communication protocol [C].Proceedings of International Conference on Communication Technology 1998 .Beijing,China:IEEE CS Press,1998.325~329. [5] Allen S Parrish,Suart HZweben.On the relationships among the all-uses, all-DU-paths, and all-edges testing criteria [J].IEEE Transaction On Software Engineering, 1995,21(12):1006~1009. [6] Chen W H.Executable test sequence for the protocol control and data portions [A].Proceedings of IEEE International Conference on Communications[C].New Orleans,USA:IEEE CS Press,2000.505~510. [7] A.Guerrouat, H.Richter. A formal approach for analysis and testing of reliable embedded systems[J]. Electronic Notes in Theoretical Computer Science, 2005, Vol.141, No.3, pp.91-106 [8] Mercedes G. Merayo, Manuel Nu′n˜ez, Ismael Rodrı′Guez. Formal testing from timed finite state machines[J].2008, Computer networks, Vol.52, pp.432–460. [9] Li Shuhao, Wang Ji, Dong Wei, Qi Zhichang. A framework of property-oriented testing of reactive systems[J]. CHINESE JOURNAL OF ELECTRONICS. 2004, Vol.32, No.12A, pp.222-225. [10] Franco,Fummi Cristina Marconcini Graziano Pravadelli. Functional Verification based on the EFSM Model[C]. Ninth IEEE International High-Level Design Validation and Test Workshop, HLDVT'04. 2004, pp.69-74.

© 2010 ACADEMY PUBLISHER

[11] A. Khoumsi, A method for testing the conformance of realtime systems, in: 7th International Symposium on Formal Techniques in Real-Time and Fault-Tolerant Systems[J], FTRTFT’02, LNCS 2469, Springer, 2002, pp. 331–354. [12] M. Krichen, S. Tripakis, An expressive and implementable formal framework for testing real-time systems[C], in: 17th International Conference on Testing of Communicating Systems, TestCom’05, LNCS 3502, Springer, 2005, pp.209–225. [13] M Vieira, M Dias, D Richardson. Object-Oriented Specification-Based Testing Using UML Statechart Diagrams[J]. In Proceedings of the 22nd International Conference on Software Engineering (ICSE 2000), New York: ACM Press, 2000 [14] H.S.Hong, Y.G.Kim, S.D.Cha, and D.H.Bae. A Test Sequence Selection Method for Reactive Systems using StateCharts[J]. Software Testing, Verification and Reliability. Vol. 10, No. 4, Page(s): 203-227, 2000, 12 [15] Yongfeng, Yin; Bin, Liu; Minyan, Lu; Zhen, Li. Test Cases Generation for Embedded Real-time Software Based on Extended UML. Information Technology and Computer Science, 2009. ITCS 2009. International Conference on Volume 1, 25-26 July 2009 Page(s):69 – 74 [16] Monalisa Sarma, Rajib Mall. Automatic Test Case Generation from UML Models. 10th International Conference on Information Technology, 2007, IEEE. [17] Monalisa Sarma, Debasish Kundu , Rajib Mall. Automatic Test Case Generation from UML Sequence Diagrams, 15th International Conference on Advanced Computing and Communications, IEEE, 2007. [18] Stephan Flake. Real-time constrains with the OCL. Proceedings of the Fifth IEEE International Symposium on Object-Oriented Real-Time Distributed Computing[J], IEEE, 2002 [19] S. Ramakrishnan, J. McGregor. Modelling and Testing OO Distributed Systems with Temporal Logic Formalisms[R]. In Proc. 18th international IASTED Conference on Applied Informatics’2000, Innsbruck, Austria, 2000 [20] Wang Xiaoping, Xuan Lefei, Zhang Wei. UML-Based Model Design and Realization in Embedded Real-Time Control System. Computer technology and development. Vol.16, No.7, 2006,pp.239-241. Yongfeng Yin was born in 1978. Now he is a lecturer and Ph. D. candidate. He received the B. S. and M.S. degrees from Beihang University, in 2000 and 2003. His research interests include system engineering, real-time embedded software testing, formal methods and software reliability. E-mail: [email protected] Bin Liu is a Ph. D. advisor and professor. His research interests include system engineering, software testing and software reliability. E-mail: [email protected] Zhen Li is a Ph. D. candidate. His research interests include system engineering, and formal methods. E-mail: [email protected] Chun Zhang is a software test engineer. His research interests is embedded software system testing. E-mail: [email protected] Ning Wu is a software test engineer. His research interests is embedded software system testing. E-mail: [email protected]

Suggest Documents