Synthesize It: From Design by Contract to Meaningful Test Input Data

Stefan J. Galler, Martin Weiglhofer, F. Wotawa
{"title":"Synthesize It: From Design by Contract to Meaningful Test Input Data","authors":"Stefan J. Galler, Martin Weiglhofer, F. Wotawa","doi":"10.1109/SEFM.2010.33","DOIUrl":null,"url":null,"abstract":"Generating test input data is a complex task and nowadays mostly tackled with random approaches. Random testing of methods, which take non primitive data types as parameters, e.g. objects encapsulating database interactions, is a vain endeavor. Especially, if the precondition of the method under test (MUT) requires a particular object state of the method’s parameters, random approaches rarely succeed. In this paper we present a technique to automatically synthesize implementations for the parameters of a MUT from a given Design by Contract specification. These implementations behave as described by the Design by Contract specification, but do not interact with their environment (e.g. database, network and file system). Furthermore, we can set the initial state of the synthesized implementations to the state required by the MUT’s precondition. Besides a formal discussion of our approach we present results obtained by applying our technique to two case studies: a stack-based calculator and a real-world data collection tool from the telecommunication industry. The presented approach outperforms random data generation on both case studies in terms of amount of methods tested (function coverage) and line coverage.","PeriodicalId":211760,"journal":{"name":"2010 8th IEEE International Conference on Software Engineering and Formal Methods","volume":"42 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2010-09-13","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"5","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"2010 8th IEEE International Conference on Software Engineering and Formal Methods","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1109/SEFM.2010.33","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 5

Abstract

Generating test input data is a complex task and nowadays mostly tackled with random approaches. Random testing of methods, which take non primitive data types as parameters, e.g. objects encapsulating database interactions, is a vain endeavor. Especially, if the precondition of the method under test (MUT) requires a particular object state of the method’s parameters, random approaches rarely succeed. In this paper we present a technique to automatically synthesize implementations for the parameters of a MUT from a given Design by Contract specification. These implementations behave as described by the Design by Contract specification, but do not interact with their environment (e.g. database, network and file system). Furthermore, we can set the initial state of the synthesized implementations to the state required by the MUT’s precondition. Besides a formal discussion of our approach we present results obtained by applying our technique to two case studies: a stack-based calculator and a real-world data collection tool from the telecommunication industry. The presented approach outperforms random data generation on both case studies in terms of amount of methods tested (function coverage) and line coverage.
综合:从契约式设计到有意义的测试输入数据
生成测试输入数据是一项复杂的任务,目前大多采用随机方法处理。随机测试以非基本数据类型作为参数的方法(例如封装数据库交互的对象)是徒劳的。特别是,如果被测方法的前提条件(MUT)需要方法参数的特定对象状态,则随机方法很少成功。在本文中,我们提出了一种从给定的契约式设计规范中自动合成MUT参数实现的技术。这些实现按照契约式设计规范的描述进行操作,但不与它们的环境(例如数据库、网络和文件系统)交互。此外,我们可以将合成实现的初始状态设置为MUT的先决条件所要求的状态。除了对我们的方法进行正式讨论之外,我们还介绍了通过将我们的技术应用于两个案例研究获得的结果:一个基于堆栈的计算器和一个来自电信行业的真实数据收集工具。就测试方法的数量(功能覆盖率)和行覆盖率而言,所提出的方法在两个案例研究中都优于随机数据生成。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信