{"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.