Real-Time Extended Interface Automata for Software Testing Cases Generation

Testing and verification of the interface between software components are particularly important due to the large number of complex interactions, which requires the traditional modeling languages to overcome the existing shortcomings in the aspects of temporal information description and software testing input controlling. This paper presents the real-time extended interface automata (RTEIA) which adds clearer and more detailed temporal information description by the application of time words. We also establish the input interface automaton for every input in order to solve the problems of input controlling and interface covering nimbly when applied in the software testing field. Detailed definitions of the RTEIA and the testing cases generation algorithm are provided in this paper. The feasibility and efficiency of this method have been verified in the testing of one real aircraft braking system.


Introduction
Interface automata, as a kind of modeling method that describes the interactions between components and the environment, have been applied gradually in many fields in recent years. By using the input assumption and output guarantee, the interface automata express the sequential relationship of the interaction between the system and the environment to describe the operation of the internal system and the action of the environment interface formally. But when it is applied in the software testing field, there are still some inevitable problems including the limited description ability of temporal information, which leads to a lack of accuracy to describe some embedded real-time system, and the neglect of input controlling and interface covering, which result in that some tests which need interface covering find it hard to use this modal conveniently.
Alur and Dill [1] put forward the timed automata method, which bring accurate time description for different state transition actions, and are able to describe the temporal relationship between different state transition actions accurately and formally by introducing the time language. But time automata pay more attention to internal information of the system instead of the interaction between the system and the environment. The timed interface automata are proposed on the basis of interface automata by De Alfaro et al. [2], which can describe the delay time and the keep time of the state transition process by introducing the two new parameters, time guard and clock variables. But there are also disadvantages of the timed interface automata. For some real-time system, the input/output signals may be periodic. However, the timed interface automata cannot provide a formalized description for the constraint and the change of a periodic variable.
Besides, the automata method also has some defects when it is applied to the software testing field. As Raffelt et al. proposed the dynamic testing method based on learning automata, as a result of the automata's learning features, the method was combined with many mature learning algorithms to make dynamic tests. At the same time, an application of web services testing is provided [3]. Its limitation is that the method is focused on network services and internal 2 The Scientific World Journal structure of cellular automata; it may not be suitable for embedded software; Nielsen and Skou proposed a real-time black box conformance testing method for uncertain systems based on timed automata model, and the experimental results show its superiority [4]. But because it is based on the timed automata, the ability of temporal information description of input and output is very limited; a new testing method has been proposed by Liangming et al. based on the interface automata model, it divides state sequences into different sections [5], and the covering algorithm is given. But it focuses on path covering of the automata model, while the interface covering cannot be guaranteed. Thus, when the traditional interface automata method is applied in software testing, especially in the interface testing of real-time system, there are some limitations. That is, the period information of the input and output cannot be described. Besides, it is not convenient to control the input value including its temporal information (especially to automatic control).
To solve the problems above, this paper puts forward the RTEIA on the basis of interface automata and timed automata; its main contributions are as follows.
(1) By applying the time words to describe the automaton of input/output action, it provides clearer and more detailed temporal information description for the automata model, which contains both the moment and the period information. With the values and the temporal information of input/output packaged, unified actions and descriptions are facilitated.
(2) By establishing input automata for each input interface to construct internal structure of input automata, this method nimbly solved the problems of input control and interface covering when applied to the software testing field.
The structure of the rest of this paper is as follows. Section 2 focuses on the theory of interface automata and related research background. Specific definition of RTEIA is given in Section 3; Section 4 mainly expounds the test case generation based on this method and presents a generation algorithm which is verified and discussed with an instance. Conclusions and outlooks for future work are in the last section.

Preliminary
In software testing, usually there is a very complex interaction between the system and the environment. For the convenience of testing modeling and automatically generating test cases, formalized description of the interface is necessary. The following lists some formal languages that describe the interface interaction based on automata theory.

Interface Automata.
De Alfaro and Henzinger put forward the interface automata in 2001 [6]. Interface automata's main features are as follows: (1) "positive method" is used to define the interface compatibility issues under different environment rules and (2) the game idea is a term used to describe the process of the problem solving.
Unlike the traditional method which records and gathers input domain and output domain, interface automata also describe the temporal characteristics of the input and output, integrate the input assumption and output guarantee, and provide formalized description. Output guarantee reflects the order of the various external services request from the interface which denotes the assumptions made to the environment. Input assumption reflects the order of the services provided to the external by the interface which denotes a description of the automata's own behavior.
Optimistic method is a kind of compatibility judging processing method of the interface and environmental relationship; the traditional method (or named pessimistic methods) is that as long as there is a kind of external environment to make illegal status be achieved, it considers the combined interface incompatible. But the optimistic method believes that as long as there is a kind of external environment which can make the combined interface function normally, it considers that they are compatible. Its advantage is to make the number of interface states greatly reduce after the combination, which makes the interface automata as a lightweighted formalized system.
Game ideas are as follows. Interface automata finally attribute the operation of the interface and the environment to a game; the environment is to find a strategy to meet all interface input assumptions as far as possible. If environment wins the game, we can consider that interfaces are compatible; otherwise, they are incompatible.
With the developing of the theory, in addition to the main application to verify components compatibility of the modular development mode, interface automata method was applied to a variety of related fields gradually; that is, because interface automata model's description of the state transition is similar to the web service user transferring and link jumping, the interface automata theory was applied to the description of building web services by Li et al. [7], and the relevant verification algorithm was given; Zhang et al. [8] applied the interface automata to analyze the usability of composite web services building, and then they proposed hybrid interface automaton based on the interface automata method. The algorithm used to check accessibility, well-formedness, and compatibility for the network physical system is given as well. Due to the lightweight and generality of interface automata model, Karimpour et al. [9] combined it with the queuing theory and applied it to the modular software system performance prediction field.

Timed Automata.
Alur and Dill put forward a kind of automata method that contains temporal information named timed automata [1]. Timed automata are a kind of formalized model based on the finite state automata extended with clock variables to describe the continuous changes of the time and analyze the behavior of the real-time systems. An important properties of this theory lies in its ability to detect the reachability of any state in the timed automata.
Timed automata introduced the time words based on the finite state automata and added clock variables into the time words to make the input and output information contain the The Scientific World Journal 3 temporal information. Timed automata use logical relationship to describe the temporal relationship between different input/output actions by the formalized language. But this method focuses on the internal state transition actions information only and does not take consideration of the interactive actions between the system and the environment.
Bengtsson and Yi did a further study of timed automata on semantics and the implementation algorithm and put forward the timed automata semantic system that can realize the model from the theory to the application. The corresponding algorithm and verification tools were provided as well [10]. Timed automata were applied to the realtime distributed system verification by Wen et al., based on constructing timed automata for controller area network, tasks, and the operating system kernel, respectively, to analyze the system and to verify its validity by experiments [11]. Calder et al. extended the interface automata with another way of temporal information and proposed RTIA real-time interface automata for scenario-based timing specifications [12]. Jin et al. expanded the method of [11] to solve the timed automata modeling problems of complex real-time systems and introduced the hierarchical timed automata (HTA) by partitioning the component level and hiding and expanding execution of corresponding chain to make the description of multilayered components more accurate [13]. Some researches were started in the timed automata model validation and the mutual transformation among different modeling languages, and so forth, [14][15][16][17].

Timed Interface Automata.
De Alfaro et al. extended the interface automaton method and proposed the timed interface automata [2].
Interface automata method introduces time constraints in order to describe the real-time system better. It adds a clock variable for interface automata; each state has a predicate made of a set of time variables called time condition. The time condition restrained the occurring conditions of the input/output and also introduced the guard which is used to restrain the input/output that shall meet the conditions.
Because the input/output actions themselves are not time-consuming, the state transition does not require any extra time. So if the executions of the input/output were repeated infinitely, the automata time will stop forever, which is obviously inconsistent with the facts. This action is known as Zeno behavior. To this end, the authors put forward a well-formedness criterion which rules that, in any reachable state, time interface automata should guarantee that the time variable of input/output actions would never stop.
In order to apply the timed automata to web services field, based on the concurrent characteristics of web services, Esmaeilsabzali et al. put forward Interface automata with complex actions. By introducing complex behaviors that do not interlace with other components for interface automata, this method can describe the characteristics of the concurrent systems better [18]. In view of the pervasive systems, Calder et al. put forward the pervasive interface automata [12], according to the characteristics of the pervasive system that context is closely linked. They expand the concept of input and output of interface automata theory and introduce the function calling and being called, so that the pervasive interface automata can be described better. Raclet et al. combined the interface automata with modal specification method, summarized the predecessors' combination method, and put forward the modal interface automata [19]. Then, Krka and Medvidovic collated and improved modal interface automata [20].
The methods above are all trying to describe the interaction of the interface including temporal information, but there are still drawbacks. For instance, the timed automata lack the view of the interface and the event description of the timed automata relies on state transition logic relationship. The timed interface automata lack a complete description of period information; besides, the ability of input controlling is scanty. Therefore, this paper presents the RTEIA, which adds clearer and more detailed temporal information description for the automata model. And, by the establishment of input interface automaton for every input interface, it also nimbly solve the input controlling and interfaces covering problems when applied in the test field.

The Real-Time Extended Interface Automata
To make up for the existing problem of interface automata model such as incomplete description temporal information and the lack of considering of the input controlling, we introduce time words and input automata for interface automata as the RTEIA.

Time Language.
Considering the defect of the interface automata when it is used to describe a real-time system, we need a language that can describe the temporal characteristics of the system input and output parameters. Therefore, we introduce and improve the concept of time language from the timed automata [1] to describe the temporal character of the real-time system. Time language contains 3 time parameters; as in the case of the dense-time model, the set of nonnegative real numbers, , is chosen as the time domain. Each input/output is coupled with two temporal parameters time sequence and period parameter as defined below.
of an input/output , is used to express the period information. A time word over an alphabet Σ is a pair ( , , ) The Scientific World Journal sequence, and denotes the period information. Timed language over Σ is a set of timed words over Σ.
Let one consider some examples of timed languages.
To describe: there is no after time 3.2, and its period is 300. Its time language can be as To describe: and are alternate, and, for the successive pairs of and , the time difference between and keeps increasing, and the period keeps decreasing in the same time. Its time language can be as To describe: and are alternate, the period of is 100, the period of is 200, and should be later than in 2, which is shown in Figure 1.
Its time language can be as 3.2. The RTEIA. With the time words as the tool for describing the temporal information, we define the RTEIA based on the interface automata method. The RTEIA packs the temporal information to describe the various actions of the automata clearly. It is defined as follows.
is a set of states; (2) init ⊆ is the initial set of states, and init contains at least one state; if init = ⌀, one says is empty; (2) is the time sequence of the input/output; (3) is the period information of the input/output.

Definition 6.
A controllable operation segment of the RTEIAP is the alternative finite sequence of states and actions: One can use an example to explain how a RTEIA describes a system.
Example 7. Figure 2 shows a simple RTEIA, according to the following definition.
RTEIA is as follows.
(1) the set of states (2) the initial set of states init = {V 0 }.
Due to the application of time words to describe the input/output actions, we can choose different transition chain to describe the temporal information of the automaton interface interaction.

Input Control of the RTEIA.
For the purpose of applying the RTEIA to software testing, we need to control the input in order to generate test cases. So, we treat the input as a RTEIA . The input automata can cross-link with the device under test and other input source devices, to realize the feedback and control of the input.
Definition 8. One defines the influence interface action as a constraint input, denoted by → . In the graphic, dotted arrow is used to denote the constraint input.
Example 9. We can establish the RTEIA model for the two input 0 , 1 from the automata in Example 7, which is shown in Figures 2 and 3.  RTEIA 0 is as follows.
(2) the initial set of states init = { 0 }. We can find that the feedback of the input 0 has been described by putting automata 's output 2 as input automata 0 's input. Input automata 1 are also cross-linked with input automata 0 . Furthermore, we can control the input of automata by the design of the internal structure of the input automata 0 1 and the manual adjustment of inputs 0 , 0 , and 1 . For example, in different state transition chains like 3 and 4 , we can get different 0 by controlling 2 and 1 , which are the input of input automata 0 .
There are mainly two characteristics of the RTEIA. Firstly, it uses time words to describe the temporal information (contains both time sequence and period information) of the input/output actions of the automata; secondly, it treat the input interface as independent automata, which is used to control the input by the cross-link of the automata and the input automata.

Test Cases Generation Based on the RTEIA
Because of the feature of the RTEIA, we apply it to the software testing field. When it is used to describe the software model, we can generate test cases automatically by some algorithms.

Input Automata Controlling.
In the interface test of realtime system, we can establish automata model for each input as input automata, using the method introduced in Section 3.3, in order to control the input and realize interface covering by design of the input automata's internal structure.
Common input automata for software interface test are shown in Figure 5.
The input automata 0 are as follows (Figure 4).
(2) the initial set of states init = { 0 }. In the input automata, 0 denotes the initial state of the automata and → 1 denotes a constraint input (coming from the main automata or another input automata) of the input automata; it means that this input is restricted by the constraint from other part; 1 denotes the start state. By inputting different 0 , 1 , 2 , we can make the input automata produce normal/abnormal output. 2 denotes normal state, which will produce a normal test case 0 , and 4 , 5 , 6 denote value abnormal state, time sequence abnormal state, and period information abnormal state, respectively. Then, 0 is produced correspondingly by controlling the input 2 to make the abnormal value lager or littler. The input automata aim to state all possibilities of the input information, which could be expected or unexpected.
For instance, the state transition chain 2 = ( 0 1 1 0 3 1 5 2 52 0 ) denotes a time sequence abnormal 0 , and its time value is too large, which means it will be inputted later than the normal one. The example is just a simple input automata model in logic. We can design a more complex internal structure of the input automata to express different test strategy in practical application.

Test Cases Generation.
We simplify the method of software interface covering by the input automata introduced in Section 4.1. When the input automata are finished with the path covering, the interface covering, which means the coverage of the interface status while test cases had been executed, of the software under test is able to be guaranteed too. We present an algorithm to generate test cases for the input automata.

Definition 10. A controllable operation segment
We apply a depth-first algorithm to cover these input automata. It will start with the ENTRY. When a controllable operating segment is searched and marked, a new search will start from the tail of the last controllable operating segment. This step will be repeated constantly.
The steps of Algorithm 1 can be summarized as follows.
Step 2. If all the controllable operation segments have been found or the coverage has been 100%, then go to Step 6; else, go to Step 4.
Step 3. Search for the next unused controllable operation segment which has tail of the last one as the head state; if found, then = + 1 and go to Step 2; else, go to Step 4; Step 4. Let = ; record the current sequence number of tested controllable operation segment. Record this operation chain as ( ) which starts with ENTRY and ends with END. Run the test and refresh the coverage.
Step 5. Search for another controllable operation segment which has the same head state with ( ) and is not marked. If found, = + 1 and go to Step 2; else, = − 1 and repeat Step 5. If all the controllable operation segments have marked, then go to Step 6.
Step 6. Display result and finish the algorithm.
We can get all kind of the input time word using this algorithm in order to realize the interface covering of the software under test.
Then, make these time words as the input fields. Choose input groups from the input fields as the input of the testing using some intelligent algorithms such as genetic algorithm or ant colony algorithm. Finally, generate the test cases set by optimizing of the feedback of the coverage continuously aiming at both the interface covering and the path covering.

Case Study.
We apply the RTEIA and the test case generation algorithm to an interface test of an aircraft braking system. The structure of the system is shown in Figure 6.
Automata are an aircraft braking system, which has 4 inputs 0 2 3 4 , corresponding to 4 input automata 0 1 2 3 . There are 3 outputs 1 5 6 ; in the same time, 1 is an input → 1 of input automata 1 which functions as a feedback.
Establish the RTEIA model, which is shown in Figure 7. The meaning of each parameter is shown in Table 1.
The unit of and is second and the units of are dimensionless, Newton, meter per second, round per minute, and millivolt.
Taking an example of the input 2 , establish the input automata 1 , which is shown in Figure 8.
The meaning of the parameters is similar to Figure 5. The constraint input → 1 means a feedback that, only when the brake system BIT is successful, can the process begin to work. 2 7 are two kind of normal state and 4 , 5 , 6 are value abnormal state, time sequence abnormal state, and period information abnormal state, respectively. 2 controls whether we will get a larger or a littler output 2 .
Using Algorithm 1, we can realize the path covering of the input automata and get a test sequence controlled by 0 1 2 . By running the test sequence, finally, we are able to get the input field of 2 as follows: After getting the input fields of all inputs of the RTEIA, we use some classical intelligent algorithms such as genetic algorithm to reduce the useless cases and to improve the testing efficiency. The sets of input fields are the inputs of the algorithm; the coverage of the automata could be used as the feedback indicator; both the interface covering and the path covering could be selected as the multiple targets of the algorithm. Then, the test set will be got. One typical testing sequence is as follows: This testing sequence means that, firstly, the system receives a startup command input 0 , which is a normal input; then the system trans to V 0 which denotes the BIT state, and BIT runs successfully and gets a normal output 1 ; then, system receives the landing information input 2 ; this input is a time sequence abnormal input; its time is later than the required time in 1 second; then the system trans to state V 4 which denotes the landing state and receives the gear wheel speed input 4 ; the speed is 43000 which belongs to the fast landing. This input is a period information abnormal input; its period is amplified to 8; then the system trans to state V 8 , outputs signal 6 of the gear hydraulic circuit to reduce the braking friction strength and prevent the gear locking; then the system ends.
By using the RTEIA to describe the interface testing of this above real-time system with temporal information accurately, testing cases have been generated automatically to improve the testing efficiency successfully.

Discussions
In terms of the functioning features, compared with the related interface automata model, such as the interface automata, the timed automata, and the timed interface automata, because of the introducing and improving of the time words, the RTEIA makes the description of temporal information more complete; besides, for establishing input automata, the RTEIA is more powerful when it is applied in the software testing field. The contrast is shown in Table 2.
The RTEIA has superiority in the description of the temporal information and input control in the field of software testing. In terms of the description of temporal information, the interface automata do not contain temporal information; it is difficult to describe periodic signal for the timed automata and the timed interface automata, though there is some improvement. In terms of the judgment of combination and complexity, because the RTEIA concentrates on the field of software testing, it shows different features from the traditional methods. In terms of the input control, unlike the traditional methods, the RTEIA treats every input as independent automata, by which it can control the input conveniently. In terms of the application in software testing field, the RTEIA is more suitable than some other related researches about interface automaton and timed interface  Yes, can describe temporal information completely and contain interface covering automata because of their limited temporal description, the interface covering guarantee, and so forth.
In terms of the algorithmic complexity, input interface automata can be represented by a directed graph. The main cost of Algorithm 1 is in the searching for the controllable operation segments corresponding to the distinguishable states. Therefore, if the interface automata are expressed in the form of adjacency matrix, the algorithm complexity would be ( 2 ), where denotes the state number of the longest execution segments; if the interface automata are expressed in the form of adjacency list, the algorithm complexity would be ( + ), where denotes the number of the execution segments.
The RTEIA solved the problems of traditional automata modeling language successfully without any increase in cost.

Conclusions
This paper proposes a new formalized modeling language named the real-time extended interface automata to describe the temporal information of the interface between the system and the environment. Based on the interface automata, the RTEIA solves the problems of the traditional automata methods by introducing time words to describe the temporal information (including the period information) of input/output actions. Meanwhile, the RTEIA is able to control the input conveniently and to realize both the path and interface covering when applied in software testing field by establishing the input automata. At last, we provided relevant algorithm and process and verified its feasibility and effectiveness by applying this method in the testing of one real aircraft braking system.
Because the RTEIA is a new method, there are still some open questions left to be solved. As part of the future work, we will investigate the ways to describe the feedback and the constraints between the input automata, and so forth. Besides, the RTEIA will be tried to be applied in more cases and fields.