• No results found

Modbat: A model-based API tester for event-driven systems

N/A
N/A
Protected

Academic year: 2021

Share "Modbat: A model-based API tester for event-driven systems"

Copied!
3
0
0

Loading.... (view fulltext now)

Full text

(1)

http://www.diva-portal.org

Postprint

This is the accepted version of a paper presented at Dependable Systems Workshop (DSW 2012).

Citation for the original published paper:

Artho, C., Biere, A., Hagiya, M., Potter, R., Ramler, R. et al. (2012)

Modbat: A model-based API tester for event-driven systems.

In: Proc. Dependable Systems Workshop (DSW 2012)

N.B. When citing this work, cite the original published paper.

Permanent link to this version:

(2)

Modbat: A model-based API tester for

event-driven systems

C. Artho

A. Biere

M. Hagiya

R. Potter

R. Ramler

Y. Tanabe

F. Weitl

M. Yamamoto

Software testing executes a system under test by giving it a series of inputs and comparing the out-puts to expected values. Model-based testing gen-erates test executions from an abstract model that describes the system behavior.

Existing model-based approaches are not well-suited for event-driven or input/output-driven sys-tems. In particular, there is a need to support non-blocking I/O operations, or operations throwing ex-ceptions when communication is disrupted.

We present a new tool called “Modbat”, which is specialized for testing the application programming interface of systems where these issues are common.

1 Introduction

Software testing executes parts of a system un-der test (SUT). Various techniques have been de-veloped to automate testing. In particular,

model-based testing has emerged as a fast-developing field,

where test cases are derived from an abstract model rather than implemented directly as code. A spe-cial model-based testing tool executes the SUT

Cyrille Artho,産業技術総合研究所, AIST Armin Biere, Johannes Kepler University

Masami Hagiya,東京大学, The University of Tokyo Richard Potter,東京大学, The University of Tokyo Rudolf Ramler, Softw. Competence Center Hagenberg Yoshinori Tanabe,国立情報学研究所, NII

Franz Weitl,千葉大学, Chiba University

Mitsuharu Yamamoto,千葉大学, Chiba University

Model Tool SUT

input output behavior 図 1 Model-based testing. start stop shutdown reconfigure

init active end

図 2 FSM modeling component behavior.

based on input/output sequences generated accord-ing to the model (see Fig. 1).

In previous work[1], we have shown that the no-tation used in existing tools [2] [3] [4] [7]is not well-suited to express the behavior of event-driven sys-tems, which include databases, file syssys-tems, and cloud computing middleware. In fact, the latter is subject of an ongoing project co-funded by JSPS, which motivated and influenced this work.

The systems mentioned above all depend on pos-sibly unreliable hardware or communication links. To adequately test these systems, more support is needed to directly denote exceptions, and actions that depend on system events [1].

Our tool called Modbat addresses these prob-lems. In Modbat, system behavior is described

∗ クラウドコンピューティングミドルウェアのソフトウェ

(3)

using finite-state machines (see Fig. 2), which can be refined using a domain-specific language (DSL) provided by Modbat. Modbat generates event

se-quences from that model, which call the application

programming interface (API) of the SUT. Results can be checked using assertions, or stored in model variables, to be used in subsequent calls.

2 Usage of Modbat

Modbat is specialized for API testing of program libraries or frameworks. It is written in Scala [5] and provides an embedded DSL [8] in which the model is specified. Any SUT that compiles to Java bytecode can be tested with Modbat. A tester uses Modbat as follows (see Fig. 3):

1. The tester defines a model using a finite-state machine that is expressed in our Scala-based DSL. The model is compiled against a library provided by Modbat. For example, a transi-tion from Fig. 2 could be written as

"init" -> "active" :=

{ c = new Component; c.start }.

2. The tester runs Modbat against the compiled model. Modbat explores the model using a random search, executing the SUT in tandem. The sequence of transitions executed between the initial and final model states constitutes a

test run. After each test run, the model and

the SUT are reset to their initial state. 3. A failure is detected when a test run violates

a property. When a failure is found, Modbat writes an error trace to a file, giving the nec-essary information to analyze the error. For debugging, a failed test can be replayed.

3 Conclusions and future work

Modbat is designed to test the API of state-based, event-driven systems. It addresses the needs of many projects including an ongoing project where we want to study the reliability of cloud

Modbat

model SUT

Scala compiler

Test model

Model library Compiled

図 3 Architecture of Modbat.

computing middleware. Modbat uses a DSL based on the Scala language to succinctly express various event-driven properties.

Future work will examine the integration of tools that generate test data [3] [4]with Modbat for gen-erating an extended set of event sequences.

We also plan to implement the output of error traces in a JUnit-compatible format, so we can compare the results achieved with Modbat to the findings of a previous study comparing manually written tests to tool-based test case generation [6].

参考文献

[1] C. Artho. Separation of transitions, actions, and exceptions in model-based testing. Post-proceedings

of 12th Int. Conf. on Computer Aided Systems The-ory (Eurocast 2009), 5717:279–286, 2009.

[2] K. Claessen and J. Hughes. QuickCheck: a lightweight tool for random testing of Haskell pro-grams. SIGPLAN Not., 35(9):268–279, 2000. [3] T. Kitamura, T. Do, H. Ohsaki, L. Fang, and

S. Yatabe. Test-case design by feature trees. In

Leveraging Applications of Formal Methods, Verifi-cation and Validation (ISoLA 2012)., volume 7609

of LNCS, pages 458–473. Springer, 2012.

[4] R. Nils. Scalacheck, a powerful tool for automatic unit testing, 2012.

[5] M. Odersky, L. Spoon, and B. Venners. Pro-gramming in Scala: A Comprehensive Step-by-step Guide. Artima Inc., USA, 2nd edition, 2010.

[6] R. Ramler, D. Winkler, and M. Schmidt. Random test case generation and manual unit testing: Sub-stitute or complement in retrofitting tests for legacy code? In 36th Conf. on Software Engineering and

Advanced Applications, pages 286–293. IEEE

Com-puter Society, 2012.

[7] M. Utting and B. Legeard. Practical Model-Based

Testing: A Tools Approach. Morgan Kaufmann Publishers, Inc., San Francisco, USA, 2006. [8] D. Wampler and A. Payne. Programming Scala.

References

Related documents

Using the benefits of model transformation techniques, maintaining traceability links between different models will be an easy approach rather than to have

Incorporating cyber into other activities, clarifying the cyber policy with regard to Article 5 and readiness to conduct full-spectrum cyber operations with shared capabilities

Detta leder till att de sjuksköterskor som har stor erfarenhet av patientgruppen är de som arbetar inom mottagningsverksamhet för HIV/AIDS- positiva. I bakgrundinformationen

Jag har försökt att hitta material som ger en viss bakgrund och förståelse för vad lärarna har att förhålla sig till och därför kommer teoridelen även att behandla problem

Powerful equation- based object-oriented (EOO) languages such as Modelica are successfully used for modeling and virtual prototyping increasingly complex physical systems

Vårt projekt är ännu i ett tidigt stadium, men vi hoppas kunna bidra till en ökad förståelse för hur komplext införandet av ny teknik i träningen är, både för idrottare

end time has been reached, we terminate the simulation in Step 7. If not, we go back to Step 2 and repeat these step until the end has been reached. The result from

How Systems Biology Can Drive the Growth of Scientific Knowledge.