测量德尔福的代码覆盖率 [英] Measuring code coverage in Delphi

查看:154
本文介绍了测量德尔福的代码覆盖率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法用DUnit测量代码覆盖率?还是有任何免费工具完成?你用什么?你通常会采取什么代码覆盖?



Jim McKeeth:谢谢你的详细答案。我正在谈论TDD方法的单元测试,不仅仅是发生故障后的单元测试。我对代码覆盖感兴趣,我可以通过一些基本的预写单元测试来实现。

解决方案

我刚刚使用Delphi 2010的基本代码覆盖工具在Google Code上创建了一个新的开源项目。 http://code.google.com/p/delphi-code-coverage/



现在它可以测量线路覆盖率,但我也打算添加类和方法覆盖率。



它生成带有摘要的html报告,并标出来源,显示哪些行被覆盖(绿色),不是(红色),而其余行没有为其生成任何代码。



更新:
Delphi代码覆盖,您可以生成与Hudson EMMA插件兼容的XML报告,以显示哈德森



更新: strong>
版本0.5带来错误修复,增加可配置性和清理报告



更新:
版本1.0带来支持对于emma输出,类和方法的覆盖以及DLL和BPL的覆盖率


Is there any way to measure code coverage with DUnit? Or are there any free tools accomplishing that? What do you use for that? What code coverage do you usually go for?

Jim McKeeth: Thanks for the detailed answer. I am talking about unit testing in the sense of a TDD approach, not only about unit tests after a failure occured. I'm interested in the code coverage I can achieve with some basic prewritten unit tests.

解决方案

I have just created a new open source project on Google Code with a basic code coverage tool for Delphi 2010. http://code.google.com/p/delphi-code-coverage/

Right now it can measure line coverage but I'm planning to add class and method coverage too.

It generates html reports with a summary as well as marked up source showing you what lines are covered (green), which were not (red) and the rest of the lines that didn't have any code generated for them.

Update: As of version 0.3 of Delphi Code Coverage you can generate XML reports compatible with the Hudson EMMA plugin to display code coverage trends within Hudson.

Update: Version 0.5 brings bug fixes, increased configurability and cleaned up reports

Update: Version 1.0 brings support for emma output, coverage of classes and methods and coverage of DLLs and BPLs

这篇关于测量德尔福的代码覆盖率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆