从契约式设计#8482中自动提取模拟对象行为测试数据生成规范

Stefan J. Galler, Andreas Maller, F. Wotawa
{"title":"从契约式设计#8482中自动提取模拟对象行为测试数据生成规范","authors":"Stefan J. Galler, Andreas Maller, F. Wotawa","doi":"10.1145/1808266.1808273","DOIUrl":null,"url":null,"abstract":"Test data generation is an important task in the process of automated unit test generation. Random and heuristic approaches are well known for test input data generation. Unfortunately, in the presence of complex pre-conditions especially in the case of non-primitive data types those approaches often fail. A promising technique for generating an object that exactly satisfies a given pre-condition is mocking, i.e., replacing the concrete implementation with an implementation only considering the necessary behavior for a specific test case. In this paper we follow this technique and present an approach for automatically deriving the behavior of mock objects from given Design by Contract#8482; specifications. The generated mock objects behave according to the Design by Contract#8482; specification of the original class. Furthermore, we make sure that the observed behavior of the mock object satisfies the pre-condition of the method under test. We evaluate the approach using the Java implementations of 20 common Design Patterns and a stack based calculator. Our approach clearly outperforms pure random data generation in terms of line coverage.","PeriodicalId":443108,"journal":{"name":"International Conference/Workshop on Automation of Software Test","volume":"55 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2010-05-03","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"21","resultStr":"{\"title\":\"Automatically extracting mock object behavior from Design by Contract#8482; specification for test data generation\",\"authors\":\"Stefan J. Galler, Andreas Maller, F. Wotawa\",\"doi\":\"10.1145/1808266.1808273\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"Test data generation is an important task in the process of automated unit test generation. Random and heuristic approaches are well known for test input data generation. Unfortunately, in the presence of complex pre-conditions especially in the case of non-primitive data types those approaches often fail. A promising technique for generating an object that exactly satisfies a given pre-condition is mocking, i.e., replacing the concrete implementation with an implementation only considering the necessary behavior for a specific test case. In this paper we follow this technique and present an approach for automatically deriving the behavior of mock objects from given Design by Contract#8482; specifications. The generated mock objects behave according to the Design by Contract#8482; specification of the original class. Furthermore, we make sure that the observed behavior of the mock object satisfies the pre-condition of the method under test. We evaluate the approach using the Java implementations of 20 common Design Patterns and a stack based calculator. Our approach clearly outperforms pure random data generation in terms of line coverage.\",\"PeriodicalId\":443108,\"journal\":{\"name\":\"International Conference/Workshop on Automation of Software Test\",\"volume\":\"55 1\",\"pages\":\"0\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2010-05-03\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"21\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"International Conference/Workshop on Automation of Software Test\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.1145/1808266.1808273\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"International Conference/Workshop on Automation of Software Test","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/1808266.1808273","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 21

摘要

测试数据的生成是自动化单元测试生成过程中的一项重要任务。随机和启发式方法是众所周知的测试输入数据生成。不幸的是,在复杂的前提条件下,特别是在非原语数据类型的情况下,这些方法往往会失败。一种很有前途的技术可以生成一个完全满足给定前提条件的对象,它是mock,也就是说,用一个只考虑特定测试用例的必要行为的实现代替具体的实现。在本文中,我们遵循这种技术,并提出了一种方法来自动从给定的契约式设计#8482中派生模拟对象的行为;规范。生成的模拟对象的行为遵循契约式设计#8482;原始类的规格说明。此外,我们确保观察到的模拟对象的行为满足被测方法的先决条件。我们使用20种常见设计模式的Java实现和基于堆栈的计算器来评估这种方法。我们的方法在线路覆盖方面明显优于纯随机数据生成。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
Automatically extracting mock object behavior from Design by Contract#8482; specification for test data generation
Test data generation is an important task in the process of automated unit test generation. Random and heuristic approaches are well known for test input data generation. Unfortunately, in the presence of complex pre-conditions especially in the case of non-primitive data types those approaches often fail. A promising technique for generating an object that exactly satisfies a given pre-condition is mocking, i.e., replacing the concrete implementation with an implementation only considering the necessary behavior for a specific test case. In this paper we follow this technique and present an approach for automatically deriving the behavior of mock objects from given Design by Contract#8482; specifications. The generated mock objects behave according to the Design by Contract#8482; specification of the original class. Furthermore, we make sure that the observed behavior of the mock object satisfies the pre-condition of the method under test. We evaluate the approach using the Java implementations of 20 common Design Patterns and a stack based calculator. Our approach clearly outperforms pure random data generation in terms of line coverage.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
自引率
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学术文献互助群
群 号:604180095
Book学术官方微信