Unit test support for Java via reflection and annotations

V. K. Proulx, Weston Jossey
{"title":"Unit test support for Java via reflection and annotations","authors":"V. K. Proulx, Weston Jossey","doi":"10.1145/1596655.1596663","DOIUrl":null,"url":null,"abstract":"Novice Java programmers face great difficulties when learning to design unit tests for any nontrivial cases. Deciding whether the result of a method, or the effect the method produced represents the expected result one must understand the difference between equality based on the values an object represents versus the reference equality (identity) --- and be able to define the correct equals method.\n We describe the tester library that supports test design, evaluation, and reporting of the results in the manner that supports a novice programmer. The library uses Java reflection and annotation to compare any two data items (primitive types or objects) by the value they represent, produces report where the expected and actual values are pretty-printed, and a failed test report includes a link to the failed test.\n The library has been used in classrooms and is used daily in our program design.","PeriodicalId":169989,"journal":{"name":"Principles and Practice of Programming in Java","volume":"75 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2009-08-27","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"12","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Principles and Practice of Programming in Java","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/1596655.1596663","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 12

Abstract

Novice Java programmers face great difficulties when learning to design unit tests for any nontrivial cases. Deciding whether the result of a method, or the effect the method produced represents the expected result one must understand the difference between equality based on the values an object represents versus the reference equality (identity) --- and be able to define the correct equals method. We describe the tester library that supports test design, evaluation, and reporting of the results in the manner that supports a novice programmer. The library uses Java reflection and annotation to compare any two data items (primitive types or objects) by the value they represent, produces report where the expected and actual values are pretty-printed, and a failed test report includes a link to the failed test. The library has been used in classrooms and is used daily in our program design.
通过反射和注释支持Java的单元测试
新手Java程序员在学习为任何重要案例设计单元测试时都面临着很大的困难。决定方法的结果或方法产生的效果是否代表预期结果,必须理解基于对象表示的值的相等与引用相等(同一性)之间的区别,并能够定义正确的equals方法。我们以支持新手程序员的方式描述支持测试设计、评估和结果报告的测试库。该库使用Java反射和注释来比较任意两个数据项(基本类型或对象)所表示的值,生成报告,其中预期值和实际值打印得很好,失败的测试报告包括指向失败测试的链接。图书馆在教室中使用,在我们的课程设计中每天都使用。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约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学术官方微信