2014 Eighth International Conference on Software Security and Reliability
Generating Test Cases for Context-aware Applications Using Bigraphs Lian Yu
Wei-Tek Tsai
School of Software & Microelectronics Peking University Beijing, 102600. P.R. China
[email protected]
School of Computing, Info., and Decision Sys. Eng. Arizona State University Tempe, Arizona, USA
[email protected]
Yanbing Jiang
Jerry Gao
School of Software & Microelectronics Peking University Beijing, 102600. P.R. China
[email protected]
College of Engineering San Jose State University San Jose, CA, USA
[email protected] Context-aware applications often have the following characteristics:
Abstract— Context-aware applications often consist of a middleware and a collection of services, which run autonomously adaptive to the changing environments, where a variety of sensors are installed in physical facilities, with end-
x
The environment may change continuously: When entities move around, the environment also changes. x State dependent: The current state of a device may depend on the state of other devices, i.e., those devices should be considered at the same time when making decisions. x Context-aware software systems: The middleware usually adopts a multiple layers architecture, provides multiple functionalities, and supports multi-channel communications between sensors in the environment and the middleware. These characteristics present a challenge to test such complex systems. In addition, the stimuli of context-aware applications come from the real world with complex and varied contextual information. If the test data of the contextual information is sampling on field, this will incur considerable resource costs of testing.
users moving around. Testing such context-aware applications is challenging due to the complex interactions among the components, especially for the complicated environment modeling. This paper extends a bigraphical sorting predicate logic as constraints to create a meta-model, builds a data model based on the bigraphical meta-model, and proposes to use the sorted bigraphical reaction system (BRS) to model the context-aware environments. Tracing the interactions between the BRS model and the middleware model generates the test cases to verify the interactions between the context-aware environments and the middleware together with the domain services. To decrease the number of test cases, this paper proposes a bigraphical pattern flow testing strategy. An example airport is demonstrated to show fault detection capabilities and reductions of test cases. Keywords— Context-aware environment modeling; Bigraphical reaction systems; Sorting predicate logic; Bigraphical data model; EFSM; Bigraphcial Pattern-flow
I.
Iqbal [1] proposes to use UML class diagram to model the entities of Real-Time Embedded System (RTES), OCL to model and generate test data automatically for the RTES testing. To model containments, such as a passenger inside a check-in zone, class diagrams need to use associations to model the containments. When a passenger moves from one WiFi zone to another, UML diagrams are not intuitive to model the mobility.
INTRODUCTION
Context-aware applications are adaptive systems that respond to the changing environments. One such system often consists of a middleware with a collection of services [10]. The middleware often provides three functions: 1) collecting context information from the environment via sensors; 2) analyzing and reasoning the situation; and 3) selecting and invoking proper services to react, which can be atomic or composite services.
A BRS (Biographical Reaction System) [5][6] is a model proposed to enable modeling of interactive systems, and emphasizes both locality and connectivity; therefore can be used to model the dynamics of the environment. Although they have demonstrated value in context-aware systems [11], biological applications [7] and business processes [6], testing has not been a focus area. This paper follows OMG meta-model architecture MOF [2], and proposes to use bigraphical sorting logic as a meta-model to constrain the construction of the data model to generate test cases.
The environment of context-aware applications comprises of physical facilities, moving entities and a variety of sensors wired or wireless connecting to backend systems. For example, in an airport, physical facilities include check-in zone, security checkpoints zone, corridors, shopping zone and gate lounge; and moving entities may refer to passengers and carry-on baggage; and a sensor may be used to detect a passenger coming-into and going-out-of a zone. The research is supported by the National Science Foundation of China (No. 61170002).
978-1-4799-4296-1/14 $31.00 © 2014 IEEE DOI 10.1109/SERE.2014.27
137
In addition, to reduce the number of test cases while maintaining the fault detection capability, this paper proposes a bigraphical-pattern flow testing strategy, similar to data-flow testing strategy, but defined on reaction rules in terms of subbigraphs instead of variables in data-flow approaches. This paper is organized as follows: Section II presents an overview of the work; Section III briefly describes the BRS and sorting logic; Section IV illustrates the bigraphical data model based on the sorting logic; Section V explains test case generation based on biographical models; Section VI demonstrates the application of the techniques to an example system; Section VII describes the related work; Section VIII discusses the issues related to this work; finally, Section IX concludes the work. II.
OVERVIEW
Create data model based on bigraphical sorting
Test Strategy
Testing System
Create an EFSM model for each sensor
Model the interactions between context-aware application and environment
Synchronize EFSM models
x
Model the interactions between the middleware and environment: Cartesian product between B-LTS and EFSM-synch results in the interaction model.
x
Generate test cases based on the interactions: Traverse the interaction model from a starting point to an end point and generate test sequences. BIBRAPHICAL REACTION SYSTEMS
A. Static Structure of Bigraphs A bigraph consists of two graphs: a place graph - a forest that captures notions of locality or containment, and a link hyper-graph that models connectivity or associations. Figure 2(a) shows a bigraph H, indicating a passenger with a ticket, and a check-in zone with a passenger and a computer inside. Figure 2(b) is the place graph, and Figure 2(c) is the link graph.
Select paths required
Test paths
Synchronize the EFSM models of the middleware: The synchronization is realized by Cartesian product that tends to result in a large number of states.
The section introduces the anatomy of a BRS. For a complete treatment of bigraphs and BRSs, readers are referred to [5][6].
Create B-Labelled TS
EFSM for Middleware
x
III.
Bigraphical Reaction Systems for The Environment of Context-aware Applications Behavior Models, Data
Create an EFSM model for each sensor in the environment: The middleware collects data from sensors in the environment; therefore, one EFSM model is created to communicate with one sensor.
In the bigraphical model based testing system, there are two tasks:
The four tasks to model the environment of the contextaware application using the BRSs are shown in Figure 1:
Create an agent and a set of reaction rules
x
Generate test cases
1
0
x
x
x
Check-in
e0 v3
v1 Ticket Passenger
Create an agent and a set of reactions rules: The agent represents the initial state of the environment, and the set of reaction rules characterizes the operational semantics of BRS, discussed in Section IV.
2
v2
Computer
v0
Fig. 1. Bigraphical model based test case generation
x
y2
y1
1
v4
0
Passenger assengerr
e1 x
(a) Bigraph H roots
Create a data model based on bigraphical sorting logic: Modeling and generating test data based on bigraphical sorting logic, and this will be discussed in Section IV.
1
0
v0
v1 v3
y1
2 e0
v2
v0
y2 v2
v1 v3
v4
e1
v4
x
Create a bigraphical labeled transition system: By matching a reaction rule against the current agent, a new agent is derived, with the matched redex replaced with the reactum. Repeating the reactions, a bigraphical labeled transition system (B-LTS) is created, with agents as states and reaction rules as labels, which will be further discussed in Section V.
sites
0
(b)
1
(c)
Fig. 2. Bigrahp H and Its Place Graph and Link Graph
The place graph (Figure 2(a)) consists of three trees; and each tree has a set of nodes, and is contained by a root or region (corresponding to the dotted border in Figure 2(a)). Each node is assigned a control, e.g., v0 and v3 are assigned to control Passenger, which is drawn from the signature ߑ of a bigraph, and the signature will be discussed in Section III. A control has a distinguishing name and an arity that determines the number and types of connecting ports available at that node to be associated with links in the link graph.
Select a sub-set of paths regarding to a test strategy: A B-LTS may contain a numerous number of paths, especially when there are loops in the B-LTS. This paper proposes a bigraphical pattern flow strategy to select a sub-set of paths, which will be further discussed in Section V.
To model the middleware using EFSM (Extended Finite State Machine), there are two tasks:
Within the place graph, in addition to regions and nodes, there may also exist sites (known as holes in some bigraphs
138
literature), which are expressed visually as shaded grey nodes as in Figure 2(a). A site is a location into which a region of another bigraph may be inserted by composition.
Figure 4 shows the graphical result of the composition, where edges e2 and e3 indicate the entry and exit of check-in area.
The link graph (Figure 2(c)) is an undirected hypergraph over the ports of the nodes of the place graph. A single (hyper) edge may connect arbitrarily many ports on different nodes. Present also within Figure 2 are names that represent (named) points at which edges of the link graph may be fused to form a single (hyper) edge. By convention, outer names are drawn upwards, and inner names are drawn downwards.
B. Dynamics of Bigraphs In bigraphs terms, dynamics is expressed as reaction, with sets of reaction rules that give possible ways in which a system might be reconfigured. A reaction rule may be thought of as having the form RėR′, where R is known as the redex and R′ as the reactum. The intuitive definition of reaction is fairly straightforward: find an instance of the redex somewhere in a bigraph G, then replace that redex with the reactum to obtain some new bigraph G′. Figure 5 shows a reaction rule, and if the redex matches a portion in G, replacing the matched portion with the reactum, and resulting in bigraph G’.
Definition 1 (Interface). An interface is a pair where 0 d j, indicating the number of sites or regions, and X is a set of (inner or outer) names. Definition 2 (Bigraph). A bigraph is a 5-tuple:
Passenger
(V, E, ctrl, prnt, link): ė Where V is a set of nodes, E is a set of hyper-edges, ctrl is a control map that assigns controls (from the signature ߑ ) to nodes, prnt is a parent map that defines the tree structure in the place graph, and link is a link map that defines the link structure. The inner interface indicates that the bigraph has k sites, and a set of inner names X. The outer interface indicates that the bigraph has m regions and a set of outer names Y. A bigraph with zero sites and an empty of inner names, is called a ground bigraph or an agent. In Figure 2, the inner interface of the place graph of Bigraph H is , the outer interface is , and bigrah H is represented as ė.