An Empirical Evaluation for Object Initialization of Member Variables in Unit Testing

Stefan Fischer, Evelyn Nicole Haslinger, Markus Zimmermann, Hannes Thaller
{"title":"An Empirical Evaluation for Object Initialization of Member Variables in Unit Testing","authors":"Stefan Fischer, Evelyn Nicole Haslinger, Markus Zimmermann, Hannes Thaller","doi":"10.1109/VST50071.2020.9051634","DOIUrl":null,"url":null,"abstract":"Automated test case generation techniques usually aim to maximize some coverage criteria. For object oriented languages, like Java, the branches that can be reached in source code, frequently depend on the internal object state. Meaning certain branches will only be taken, if fields inside the tested class are set to specific values. It is however not obvious how much of the internal object state can be controlled. In this paper, we analyzed a corpus of 110 open source systems to evaluate how settable their classes are. Meaning we looked for ways that fields inside classes can be written. For instance, we analyzed the source code to identify setter methods that can be used to set the values of a field. Our results show that 66.5% of fields can be set to a desired value, while 31.5% of fields may be only settable to particular values or require a more in depth analysis. Only for 2% of fields, we did not find any way to set their values.","PeriodicalId":362588,"journal":{"name":"2020 IEEE Workshop on Validation, Analysis and Evolution of Software Tests (VST)","volume":"19 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2020-02-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"1","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"2020 IEEE Workshop on Validation, Analysis and Evolution of Software Tests (VST)","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1109/VST50071.2020.9051634","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 1

Abstract

Automated test case generation techniques usually aim to maximize some coverage criteria. For object oriented languages, like Java, the branches that can be reached in source code, frequently depend on the internal object state. Meaning certain branches will only be taken, if fields inside the tested class are set to specific values. It is however not obvious how much of the internal object state can be controlled. In this paper, we analyzed a corpus of 110 open source systems to evaluate how settable their classes are. Meaning we looked for ways that fields inside classes can be written. For instance, we analyzed the source code to identify setter methods that can be used to set the values of a field. Our results show that 66.5% of fields can be set to a desired value, while 31.5% of fields may be only settable to particular values or require a more in depth analysis. Only for 2% of fields, we did not find any way to set their values.
单元测试中成员变量对象初始化的经验评估
自动化测试用例生成技术通常旨在最大化一些覆盖标准。对于面向对象的语言,如Java,源代码中可以到达的分支通常依赖于内部对象状态。这意味着只有当被测试类中的字段被设置为特定值时,才会采用某些分支。然而,有多少内部对象状态可以被控制并不明显。在本文中,我们分析了110个开源系统的语料库,以评估它们的类是如何可设置的。这意味着我们寻找可以编写类中的字段的方法。例如,我们分析了源代码,以识别可用于设置字段值的setter方法。我们的结果表明,66.5%的字段可以设置为所需值,而31.5%的字段可能只能设置为特定值或需要更深入的分析。只有2%的字段,我们没有找到任何方法来设置它们的值。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约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学术文献互助群
群 号:604180095
Book学术官方微信