Is Exceptional Behavior Testing an Exception?: An Empirical Assessment Using Java Automated Tests

F. Dalton, Márcio Ribeiro, G. Pinto, Leo Fernandes, Rohit Gheyi, B. Neto
{"title":"Is Exceptional Behavior Testing an Exception?: An Empirical Assessment Using Java Automated Tests","authors":"F. Dalton, Márcio Ribeiro, G. Pinto, Leo Fernandes, Rohit Gheyi, B. Neto","doi":"10.1145/3383219.3383237","DOIUrl":null,"url":null,"abstract":"Software testing is a crucial activity to check the internal quality of a software. During testing, developers often create tests for the normal behavior of a particular functionality (e.g., was this file properly uploaded to the cloud?). However, little is known whether developers also create tests for the exceptional behavior (e.g., what happens if the network fails during the file upload?). To minimize this knowledge gap, in this paper we design and perform a mixed-method study to understand how 417 open source Java projects are testing the exceptional behavior using the JUnit and TestNG frameworks, and the AssertJ library. We found that 254 (60.91%) projects have at least one test method dedicated to test the exceptional behavior. We also found that the number of test methods for exceptional behavior with respect to the total number of test methods lies between 0% and 10% in 317 (76.02%) projects. Also, 239 (57.31%) projects test only up to 10% of the used exceptions in the System Under Test (SUT). When it comes to mobile apps, we found that, in general, developers pay less attention to exceptional behavior tests when compared to desktop/server and multi-platform developers. In general, we found more test methods covering custom exceptions (the ones created in the own project) when compared to standard exceptions available in the Java Development Kit (JDK) or in third-party libraries. To triangulate the results, we conduct a survey with 66 developers from the projects we study. In general, the survey results confirm our findings. In particular, the majority of the respondents agrees that developers often neglect exceptional behavior tests. As implications, our numbers might be important to alert developers that more effort should be placed on creating tests for the exceptional behavior.","PeriodicalId":334629,"journal":{"name":"Proceedings of the 24th International Conference on Evaluation and Assessment in Software Engineering","volume":"1 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2020-04-15","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"5","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the 24th International Conference on Evaluation and Assessment in Software Engineering","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/3383219.3383237","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 5

Abstract

Software testing is a crucial activity to check the internal quality of a software. During testing, developers often create tests for the normal behavior of a particular functionality (e.g., was this file properly uploaded to the cloud?). However, little is known whether developers also create tests for the exceptional behavior (e.g., what happens if the network fails during the file upload?). To minimize this knowledge gap, in this paper we design and perform a mixed-method study to understand how 417 open source Java projects are testing the exceptional behavior using the JUnit and TestNG frameworks, and the AssertJ library. We found that 254 (60.91%) projects have at least one test method dedicated to test the exceptional behavior. We also found that the number of test methods for exceptional behavior with respect to the total number of test methods lies between 0% and 10% in 317 (76.02%) projects. Also, 239 (57.31%) projects test only up to 10% of the used exceptions in the System Under Test (SUT). When it comes to mobile apps, we found that, in general, developers pay less attention to exceptional behavior tests when compared to desktop/server and multi-platform developers. In general, we found more test methods covering custom exceptions (the ones created in the own project) when compared to standard exceptions available in the Java Development Kit (JDK) or in third-party libraries. To triangulate the results, we conduct a survey with 66 developers from the projects we study. In general, the survey results confirm our findings. In particular, the majority of the respondents agrees that developers often neglect exceptional behavior tests. As implications, our numbers might be important to alert developers that more effort should be placed on creating tests for the exceptional behavior.
异常行为测试是一个异常吗?:使用Java自动化测试的经验评估
软件测试是检查软件内部质量的关键活动。在测试期间,开发人员经常为特定功能的正常行为创建测试(例如,这个文件是否正确上传到云端?)然而,很少有人知道开发人员是否也为异常行为创建了测试(例如,如果在文件上传期间网络故障会发生什么?)为了尽量减少这种知识差距,在本文中,我们设计并执行了一项混合方法研究,以了解417个开源Java项目如何使用JUnit和TestNG框架以及AssertJ库测试异常行为。我们发现254个(60.91%)项目至少有一个测试方法专门用于测试异常行为。我们还发现,在317个(76.02%)项目中,针对异常行为的测试方法的数量相对于测试方法的总数在0%到10%之间。此外,239个(57.31%)项目只测试在测试系统(SUT)中使用的异常的10%。当谈到手机应用时,我们发现,与桌面/服务器和多平台开发者相比,开发者通常不太关注异常行为测试。一般来说,与Java Development Kit (JDK)或第三方库中可用的标准异常相比,我们发现更多的测试方法涵盖了自定义异常(在自己的项目中创建的异常)。为了对结果进行三角测量,我们对来自所研究项目的66名开发者进行了调查。总的来说,调查结果证实了我们的发现。特别是,大多数受访者同意开发人员经常忽略异常行为测试。作为暗示,我们的数字对于提醒开发人员应该投入更多的精力为异常行为创建测试可能很重要。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约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学术官方微信