• Aucun résultat trouvé

Muteria: An Extensible and Flexible Multi-Criteria Software Testing Framework

N/A
N/A
Protected

Academic year: 2021

Partager "Muteria: An Extensible and Flexible Multi-Criteria Software Testing Framework"

Copied!
4
0
0

Texte intégral

(1)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58

59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116

Muteria: An Extensible and Flexible Multi-Criteria Software Testing Framework

Thierry Titcheu Chekam

[email protected] SnT, University of Luxembourg

Luxembourg

Mike Papadakis

[email protected] SnT, University of Luxembourg

Luxembourg

Yves Le Traon

[email protected] SnT, University of Luxembourg

Luxembourg

ABSTRACT

Program based test adequacy criteria (TAC), such as statement, branch coverage and mutation give objectives for software testing.

Many techniques and tools have been developed to improve each phase of the TAC-based software testing process. Nonetheless, The engineering effort required to integrate these tools and techniques into the software testing process limits their use and creates an over- head to the users. Especially for system testing with languages like C, where test cases are not always well structured in a framework.

In response to these challenges, this paper presentsMuteria, a TAC-based software testing framework.Muteriaenables the inte- gration of multiple software testing tools.

Muteriaabstracts each phase of the TAC-based software testing process to provide tool drivers interfaces for the implementation of tool drivers. Tool drivers enableMuteriato call the corresponding tools during the testing process. An initial set of drivers for KLEE, Shadow andSEMutest-generation tools,Gcov, andcoverage.py code coverage tools, andMartmutant generation tool for C and Python programming language were implemented with an average of 345 lines of Python code. Moreover, the user configuration file required to measure code coverage and mutation score on a sample C programs, using theMuteriaframework, consists of less than 15 configuration variables.

Users of theMuteriaframework select, in a configuration file, the tools and TACs to measure. TheMuteriaframework uses the user configuration to run the testing process and report the outcome.

Users interact withMuteriathrough its Application Programming Interface and Command Line Interface.Muteriacan benefit to re- searchers as a laboratory to execute experiments, and to software practitioners.

KEYWORDS

software testing, framework, extensible, test adequacy criteria, multi-tools, multi-languages

ACM Reference Format:

Thierry Titcheu Chekam, Mike Papadakis, and Yves Le Traon. 2020. Muteria:

An Extensible and Flexible Multi-Criteria Software Testing Framework. In AST ’20: International Conference on Automation of Software Test (AST ’20), October 7–8, 2020, Seoul, Republic of Korea.ACM, New York, NY, USA, 4 pages.

https://doi.org/10.1145/3387903.3389316

ACM acknowledges that this contribution was authored or co-authored by an employee, contractor or affiliate of a national government. As such, the Government retains a nonexclusive, royalty-free right to publish or reproduce this article, or to allow others to do so, for Government purposes only.

AST ’20, October 7–8, 2020, Seoul, Republic of Korea

© 2020 Association for Computing Machinery.

ACM ISBN 978-1-4503-7957-1/20/05...$15.00 https://doi.org/10.1145/3387903.3389316

1 INTRODUCTION

Test adequacy criteria (TAC) based software testing has gained more attention among researchers and is becoming widely used in practice[1, 13]. A TAC-based software testing process, as depicted in Figure 1 (more details in section 2) involves using TACs to evaluate and improve test suites. Several phases (steps) of the software test- ing process optimize the execution (represented with dashed lines in the Figure 1). Many tools and techniques have been developed to help software developers test their software [1, 2, 5, 10, 11, 13].

These tools and techniques are used to increase the fault detection, provide some guarantee of the software correctness and reduce the cost of software testing through automation of the process [5]. Nev- ertheless, with the proliferation of programming languages, TACs and software testing tools, developers need to exert supplementary effort to learn to use newly-developed tools, and integrate them into their test environment. Furthermore, researchers exert much effort to implement and evaluate their developed techniques and often, a great deal of engineering effort is required in order to integrate their implementation with other tools. These challenges are mainly affecting programming languages such as C, where, system tests are not always well structured (can be a set of bash scripts) and the data is represented by each tool regardless of the others.

This paper presentsMuteriain response to those challenges.

Muteriaprovides a collection of simplified drivers interfaces for integration of software testing tools (implementing different aspects of the TAC-based software testing process). Tools are integrated intoMuteriathrough drivers that implement interface functions to enableMuteriato call the tools. These drivers can be made publicly available with the corresponding tools.

TheMuteriaframework provides:

• The Flexibility to add support for new TACs and program- ming languages.

• An Interface to implement drivers to integrate new tools.

• A controller that handles the integration of the tools.

• A Reporter that computes metrics and display results.

The remaining of the paper will present in section 2 the moti- vation for buildingMuteria. In section 3, an overview ofMuteria is presented and, a case study is shown in section 4. Finally, the related works and conclusion are presented in sections 5 and 6 respectively.

2 BACKGROUND AND MOTIVATION 2.1 Software Testing Process

Figure 1 presents an overview of a test adequacy criteria (TAC) based software testing process, adapted from the “Two mutation processes” presented by Offut [5]. During the process, tests, that are

1

(2)

117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174

AST ’20, October 7–8, 2020, Seoul, Republic of Korea Thierry Titcheu Chekam, Mike Papadakis, and Yves Le Traon

175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 Input Test

program (P) Prog.

TACs Instrumentations

TAC Generation(Results in test objectives TO) TACs Selection

& Prioritization

TACs Equivalence and duplicate

detection

Select Target TACs for Test- Generation TOT

Generate Tests GT Existing Tests

(ET) Select Tests ST from 𝑬𝑬𝑬𝑬 ∪ 𝑮𝑮𝑬𝑬

Test execution on P

Pis correct?

Test case prioritization of ST Run ST on P

Fix P No

Yes

End

Test objective’s test execution Test objective’s

test execution optimization

Run ST on TO and/or TOT

Enough Coverage?

End

No Yes

Process 1

Process 2 Process 1 and Process 2 OR

Legend Steps Group (the order may vary)

Figure 1: Test Adequacy Criteria (TAC) based software test- ing process (adapted from Offut’s “Two mutation processes”

[5]). TheProcess 1is adapted from the “Traditional process”

andProcess 2from the “Post-Mothra Process”

either manually or automatically generated, are executed (after pos- sible selection/prioritization) on the program under test (PUT)P, to check for failures due to potential faults (in the presence of faults, the process is interrupted, the user repairs the program and restarts the process). The test suites are evaluated using TACs’ coverage and improved to maximize TACs’ coverage. The TACs’ test objectives are generated by instrumenting the PUT. For faster execution, the TACs’ test objectives of interest may be selected (for instance, a random number of mutants are selected based on mutation opera- tors in the case of mutation testing [9] or, most likely to be faulty statements are selected in case of statement coverage). The tests are executed (with possible optimization such as optimizing strong mutation using weak mutation [4]) on the TACs’ instrumented programs and the coverage values are computed. The computed TACs’ coverage values are reported to the user who, based on the values, may generate more tests to increase the coverages.

There are two variants of the process: inprocess 1, the targeted TACs coverage is reached before the PUT is checked for correctness while inprocess 2, the PUT is checked for correctness before the TACs’ coverage is measured.

Each phase of the preceding process have been subject to re- search leading to development of new techniques and tools. Nonethe- less, researchers exert a great deal of engineering effort to build prototypes of their techniques which, often, are not easy to use due to the engineering effort needed in order to integrate them into the software testing process. Moreover, the experimental evaluations of the developed techniques require that scripts are implemented to integrate the prototypes with other existing tools.

2.2 Why A New Framework?

The reasons behindMuteriaare to provide the following.

A laboratory framework for TAC-based software testing re- searchthat allows researchers to implement and evaluate their techniques with little effort.

Simplify the development of TAC-based software testing toolsby providing out-of-the-box integration with other existing tools.

Ease the use of TAC-based software testing techniquesthrough rich user interfaces and configuration.

3 MUTERIA FRAMEWORK OVERVIEW

We believe that a well designed software testing framework should be easy to use, provide good user interfaces and be easy to mod- ify for different uses.Muteriaframework implements the different phases of the TAC-based software testing process, depicted in Fig- ure 1, with extensible interfaces.Muteriauses a modular approach [8] for the implementation of its functionalities.

3.1 Design Goals

In this section, we present the main features ofMuteriathat support its design.

3.1.1 Extensible.The modular design ofMuteriaframework sep- arates the phases of the TAC-based software testing process into different components. Within each component, multiple tools that implement the corresponding phases can be integrated into the framework. Integrating a new tool intoMuteriasimply requires to extend the corresponding component’stool driverinterface. Such a design enables the development of drivers for new tools on a specific component, independently of the tools used in other components.

3.1.2 Configurable.Muteriaprovides a wide space of configura- tions that allow the users to have deep control over the execution of the framework. The framework allows the users to configure the execution of the software testing process by specifying the test adequacy criteria to use during testing, whether to reuse preceding execution data or not (useful for example for regression testing), the level of concurrency and, which metrics to report and how to report them. The underlying test generation tools, test adequacy criteria tools and test execution optimization techniques can also be configured collectively or individually (tool specific configuration).

3.1.3 Multi Programming Language Support.TheMuteriaframe- work separately supports multiple programming language by inte- grating the testing tools of the same programming language. For instance, using the framework on a C language program allows only the use of tools supporting C programs. Therefore, the framework’s extension tools are grouped by programming languages.

3.2 User Interaction

Muteriaframework provide 2 main forms of user interaction.

3.2.1 Application Programming Interface.Users can integrateMu- teriainto other frameworks through its application programing interface (API). Moreover,Muteria’s components can be used as libraries to build different frameworks.

3.2.2 Command Lines.As most frameworks,Muteriaprovides a rich command lines interface (CLI), allowing users to execute the framework from terminals.

2

(3)

233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290

Muteria: An Extensible and Flexible Multi-Criteria Software Testing Framework AST ’20, October 7–8, 2020, Seoul, Republic of Korea

291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348

3.3 Architecture

Figure 2 presents an overview of the architecture of theMuteria framework. The core of the framework is made of the following components:

3.3.1 Controller. This component organizes the tasks to be exe- cuted, based on the configuration, and calls the relevant components for each of the executions. It implements the integration between the tools implementing different phases of the software testing process.

3.3.2 Code Manager. This component manages the code repository of the PUT. It also provides functions to build code (convert from one code representation to another).

3.3.3 Test Cases Manager. This component provides an abstraction of test generation and test execution to the framework. Multiple test generation and test execution tools can be integrated through drivers on this component. Manually written tests are also managed by this component. This component provides high level functions to generate and to execute tests. These functions are mapped to the underlying tools through the tool drivers.

3.3.4 TAC Manager.Similar to the Test Cases Manager, this com- ponent provides an abstraction of each implemented TAC’s instru- mentation tool. Multiple TACs tools can be integrated through drivers on this component. Each tool may implement support for multiple TACs. This component provides functions to instrument the PUT for the given TACs and to execute a test set against the instrumented programs (by calling the Test Case Manager).

3.3.5 Test Execution Optimizer.This component provides func- tions to select and prioritize tests cases (e.g. for regression testing).

New test execution optimizing techniques’ implementations can be integrated into this component.

3.3.6 Test Generation Guidance. This component implements func- tions to select, during the test generation process, "important" TACs’

test objectives to focus on (e.g. select likely fault revealing state- ments or mutants [11] and use them to guide automated test case generation to reveal potential faults).

3.3.7 TAC Execution Optimizer. This component provides func- tions to select and/or prioritize TACs’ test objectives for execution (e.g. using weak mutation to improve execution time of strong mutation [4]). This is useful, for instance, for strong mutation in regression testing, where the optimizer could statically select the mutants likely to be relevant to the area of interest in the program under test.

3.3.8 Reporters.This component provides functions to compute useful metrics (such as code coverage, mutants subsumption and execution time) and present to the user.

3.4 Implementation

TheMuteriaframework is implemented in Python programming language. The extension tools’ drivers are also implemented in Python programming language. The integrity of the code reposi- tory of the PUT is ensured using git1(some TACs, e.g. mutation,

1https://gitpython.readthedocs.io/en/stable/

Web UI/Server CLI

Framework API (UI)

Controller

Code Manager

Test Case Manager

Reporter

TAC Manager Test Generation

Guidance

Test Execution

Optimizer TAC Execution

Optimizer Test Generation

Guidance

User Interface

User Interface

Figure 2: Architecture of Muteria framework. The com- ponents with black rectangle provide interfaces for corre- sponding tools to connect to the framework. The controller enable the integration. All components are accessible by the users through the framework API.

may modify source files). There have been many challenges in the development of the framework, and the greatest were the modu- larization of the framework and design of tool driver interfaces.

TheMuteriaframework is publicly available2open source. Installa- tion is done by runningpip install muteria. A docker image is also available2.

4 CASE STUDY

We implemented a set of drivers for several C programming lan- guage software testing tools, namely: GNU Gcov code coverage measurement tool,Mart[12] mutant generation tool (based on LLVM3and usable through command line interface), KLEE [2] test generation tool, Shadow [6] symbolic execution-based patch test generation tool, andSEMu[3] mutant test generation tool. We also implemented drivers for Python code coverage measurement tool Coverage.py4. Table 1 summarizes the implementation sizes of the drivers.

We also present in Table 2 the number of configuration vari- ables that the user needs to provide to run the testing process on a software using the selected tools.

The sample reported coverage information for the execution of Muteriaon a sample C program is shown in Figure 3.

5 RELATED WORKS

Many frameworks have been designed and developed to support TAC-based software testing. Most of those frameworks either fo- cus on specific programing languages, specific TAC or support specific test runners. Moreover, very often, there is no straightfor- ward approach to integrate those with other tools. Stryker [1] is an open-source mutation testing framework that supports several programming languages (currently three) and enable integration with multiple test runners. Nevertheless, currently, Stryker neither

2https://github.com/muteria/muteria 3https://llvm.org/

4https://github.com/nedbat/coveragepy 3

(4)

349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406

AST ’20, October 7–8, 2020, Seoul, Republic of Korea Thierry Titcheu Chekam, Mike Papadakis, and Yves Le Traon

407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464

Table 1: Muteria in Practice: Implemented drivers sizes (Python LOC) for several tools

Tool Name Tool Type Driver Size (LOC)

GNU Gcov Statement, Branch, Func-

tion Coverage 404

Mart Mutant Coverage and

Strong/Weak Mutation 452

KLEE Test generation 438

Shadow Patch Test generation 304

SEMu Mutation Test generation 236

custom Manually built system tests 237 Table 2:Muteriain Practice: Some User Configurations

Language Testing scenario # Config. Vars.

Python Measure unit tests State-

ment/branch Coverage 8

C/C++ Measure system tests and generated tests Statement, Branch, Function Coverage and weak, strong muta- tion scores

16

Figure 3: report of software testing withMuteria.

provides support for adding test adequacy criteria nor supports integration with various mutation tools or test generation tools.

Open Code Coverage Framework (OCCF) [10] is a framework that aim to simplify the development of code coverage measurement in multiple programming languages. OCCF does not provide mech- anisms to integrate such coverage measurement tools with other types of tools such as test generation tools. OCCF is orthogonal withMuteriaand can be used alongsideMuteriaby developping Muteriadrivers for the tools developed with OCCF. The Mothra mutation framework [5] was built with the goal to be expandable and adaptable. In fact, Mothra tool-set was designed to be like a laboratoryfor future research [5], which is also an important philos- ophy forMuteria. Nevertheless, Mothra was designed for Fortran programs and for mutation TAC.Muterialearned from Mothra and generalized to support different TACs and programming languages.

6 CONCLUSION

This paper presentsMuteria, a framework that integrates tools de- veloped for software testing.Muteriaframework can be extended

to supports other programming languages and provides the flexi- bility to add support for new test adequacy criteria (TAC).Muteria provide simple interfaces to implement drivers for various soft- ware testing tools such as test-case prioritization, mutant selection, test-generation, etc, tools.Muteriaalso provide rich configuration options. The main limitation ofMuteriais the possible loss of per- formance due to the generalizability. In fact, some test execution optimization techniques that are language specific may not be us- able withMuteria. Moreover,Muteriainherits the performance limitation of the integrated tools.

Muteriaframework can be used by researchers to experiment with their findings and run experiments, and also by practitioners.

Muteriaframework was developed as a result of the challenges encountered while conducting previous research [7, 11, 13].Muteria is publicly available: https://github.com/muteria/muteria.

ACKNOWLEDGMENTS

This work was supported by the AFR PhD Grant of the National Research Fund, Luxembourg, to Thierry Titcheu Chekam.

REFERENCES

[1] 2020. Stryker Mutation Framework. https://stryker-mutator.io/. Accessed:

24-01-2020.

[2] Cristian Cadar, Daniel Dunbar, and Dawson R. Engler. 2008. KLEE: Unassisted and Automatic Generation of High-Coverage Tests for Complex Systems Programs.

In8th USENIX Symposium on Operating Systems Design and Implementation, OSDI 2008, December 8-10, 2008, San Diego, California, USA, Proceedings. 209–224.

http://www.usenix.org/events/osdi08/tech/full_papers/cadar/cadar.pdf [3] Thierry Titcheu Chekam, Mike Papadakis, Maxime Cordy, and Yves Le Traon.

2020. Killing Stubborn Mutants with Symbolic Execution. arXiv:cs.SE/2001.02941 [4] Sang-Woon Kim, Yu-Seung Ma, and Yong-Rae Kwon. 2013. Combining weak and strong mutation for a noninterpretive Java mutation system.Software Testing, Verification and Reliability23, 8 (2013), 647–668. https://doi.org/10.1002/stvr.1480 arXiv:https://onlinelibrary.wiley.com/doi/pdf/10.1002/stvr.1480

[5] Jeff Offutt. 2011. A mutation carol: Past, present and future.Information and Software Technology53, 10 (2011), 1098 – 1107. https://doi.org/10.1016/j.infsof.

2011.03.007 Special Section on Mutation Testing.

[6] Hristina Palikareva, Tomasz Kuchta, and Cristian Cadar. 2016. Shadow of a doubt:

testing for divergences between software versions. InProceedings of the 38th International Conference on Software Engineering, ICSE 2016, Austin, TX, USA, May 14-22, 2016. 1181–1192. https://doi.org/10.1145/2884781.2884845

[7] Mike Papadakis, Thierry Titcheu Chekam, and Yves Le Traon. 2018. Mutant Qual- ity Indicators. Inthe 13th International Workshop on Mutation Analysis (Mutation 2018).

[8] David Lorge Parnas. 1972. On the Criteria to Be Used in Decomposing Systems into Modules.Commun. ACM15, 12 (Dec. 1972), 1053–1058. https://doi.org/10.

1145/361598.361623

[9] Goran Petrovic and Marko Ivankovic. 2018. State of Mutation Testing at Google.

In40th IEEE/ACM International Conference on Software Engineering: Software Engineering in Practice Track, ICSE-SEIP 2018, May 27 - 3 June 2018, Gothenburg, Sweden.

[10] Kazunori Sakamoto, Hironori Washizaki, and Yoshiaki Fukazawa. 2010. Open Code Coverage Framework: A Consistent and Flexible Framework for Measur- ing Test Coverage Supporting Multiple Programming Languages. In2010 10th International Conference on Quality Software. 262–269. https://doi.org/10.1109/

QSIC.2010.42

[11] Thierry Titcheu Chekam, Mike Papadakis, Tegawendé F. Bissyandé, Yves Le Traon, and Koushik Sen. 2019. Selecting fault revealing mutants.Empirical Software Engineering(18 Dec 2019). https://doi.org/10.1007/s10664-019-09778-7 [12] Thierry Titcheu Chekam, Mike Papadakis, and Yves Le Traon. 2019. Mart: A Mutant Generation Tool for LLVM. InProceedings of the 2019 27th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering (ESEC/FSE 2019). Association for Computing Machinery, New York, NY, USA, 1080–1084. https://doi.org/10.1145/3338906.

3341180

[13] Thierry Titcheu Chekam, Mike Papadakis, Yves Le Traon, and Mark Harman.

2017. An empirical study on mutation, statement and branch coverage fault revelation that avoids the unreliable clean program assumption. InProceedings of the 39th International Conference on Software Engineering, ICSE 2017, Buenos Aires, Argentina, May 20-28, 2017. 597–608. https://doi.org/10.1109/ICSE.2017.61 4

Références

Documents relatifs

Fig 3: Feature values from the Somatic Features Test of HippoUnit applied to several published

In order to study the coherence between the notion of conformance applied to an implementation under test and its specifcation, and the notion of test case generated by our

Users of Mart can provide mutation configuration files (mutants operators and mutation scope), decide whether to apply in-memory TCE, decide whether to output weak mutation

Our solution, called UTTOS, aims to execute the code in the OS, mocking UEFI specific dependencies, thus allowing unit tests to be run in the same development environment and

Going back to the three-parts structure of a test case, and recalling that the uncer- tainty requires that every test case must be executed several times: (1) the initial situa-

on the expertise of the designer. All the previously mentioned software come with a graphical interface that allows interactions with the user/designer but none of them allow

Trying to deal with these usability challenges, this paper proposes an MDE-based tool that allows defining the models for the organizational software process and the

Since the second-order discontinuity points can be found in any of the global optimization algorithms the efficiency of the proposed algorithm FDM was compared with