UsingEclEmmatoWriteBetterUnitTests-创新互联

转载:http://ericanderson.us/2008/05/08/using-eclemma-to-write-better-unit-tests/

创新互联网站建设公司提供网站设计和自适应建站服务。团队由有经验的网页设计师、程序员和市场专家组成,能够提供从H5技术,网站制作,广告投放平台,模板建站到微信平台小程序开发等全方位服务。 以客户为中心,致力于为客户提供创新、高效的解决方案,帮助您打造成功的企业网站。

If you don’t already write unit tests you should be. (Hey, why aren’t you writing unit tests?) Unit testing has so many benefits and the upfront developer cost to write some unit tests can pay huge dividends later when you aren’t spending time debugging broken code nor attempting to save face due to clueless mistakes. You can also use them as a contract to the expectations of your implementations.

[@more@]

So, assuming you have some unit tests, how useful are they if they don’t test everything? At some level you will want to have a good idea that you’re testing everything. (NOTE: I mean everything really important. Writing perfect 100% coverage like this would likely be too expensive for the entire codebase.) This is where Emma comes in (and more importantly for us, EclEmma, an Eclipse plugin for Emma). Emma is a code coverage tool which lets you visual which parts of your code get executed during some execution (regular or JUnit).

Lets walk through using EclEmma to ensure that we have adequate testing being done. Lets test the following two classes.

GuessTheNumber.java:

view sourceprint?
分享名称:UsingEclEmmatoWriteBetterUnitTests-创新互联
文章来源:http://bzwzjz.com/article/dgpggi.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 营销网站建设 网站设计 成都商城网站制作 重庆网站设计 古蔺网站建设 成都网站建设 重庆企业网站建设 H5网站制作 网站建设方案 成都网站建设 成都网站制作 教育网站设计方案 响应式网站设计 网站建设费用 成都网站制作 网站制作 网站制作公司 高端网站设计 成都h5网站建设 外贸网站设计方案 手机网站建设 成都网站制作