使用 FinalBuilder 和 AQTime 获取 DUnit 测试覆盖率统计信息

发布于 2024-08-22 13:26:58 字数 420 浏览 12 评论 0原文

我们有一个大型 Delphi 项目(150 万行代码),并且我们正在转向使用敏捷流程。

我们已经有了一个持续集成环境 (FinalBuilder),我已将其更新为在发给我们开发团队中每个人的电子邮件中包含单元测试 (dUnit) 和代码指标 (CodeHealer)。我们的单元测试覆盖率不是很好,所以我现在尝试将 AQtime 纳入其中,以获得每个构建的一些测试覆盖率结果。

我使用“执行程序”任务来运行单元测试可执行文件,记录结果并随后解析文件。我打算使用“运行脚本”任务来运行 AQtime(通过 COM)并将结果导出到 XML,以便我可以解析这些结果。

我遇到的问题是 AQtime 运行单元测试可执行文件,我失去了直接监视单元测试可执行文件的能力。我想让 FinalBuilder 解析这两个任务的结果。有谁知道当从 AQtime 调用 dUnit 结果时如何访问它?

We have a large Delphi project (1.5 million lines of code), and we're moving to using agile processes.

We already have a continous integration environment (FinalBuilder) which I've updated to include unit tests (dUnit) and code metrics (CodeHealer) in the e-mails to everyone in our development team. Our unit test coverage isn't great, so I'm now trying to get AQtime into the mix for some test coverage results on every build.

I'm using the "Execute Program" task to run the unit test executable, log the results and parse the file afterwards. I intend to use the "Run Script" task to run AQtime (via COM) and export the results to XML so I can parse through those results.

The issue I have is with AQtime running the unit test executable, I lose the ability to monitor the unit test executable directly. I'd like to get FinalBuilder to parse the results of both tasks. Does anybody know how to get access to the dUnit results when it's called from AQtime?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

诗化ㄋ丶相逢 2024-08-29 13:26:58

我们沿着相同的路径运行,并且不从 AQTime 运行 DUnit 测试,

而是使用 FinalBuilder 构建并运行 Dunit 测试。

我们的单元测试使用 XmlTestRunner,那么我们可以知道是否
在生成的 XML 文件上使用 XPath 查询时,测试会失败或不太容易失败。

更新: FinalBuilder 7.0 的最新更新现在支持 DUnit。它通过它自己的 XMLTestrunner.pas 来实现,安装后该文件位于 FinalBuilder 目录下。
该运行程序以与 NUnit 相同的格式输出测试结果。然后它可以很好地集成到 FinalBuilder Server 中。

We ran down this same path, and we don't run DUnit test from AQTime,

Instead we build and run our Dunit Tests using FinalBuilder.

Our unit tests use XmlTestRunner, then we can know if the
test fails or not very easily using an XPath Query on the resulting XML File.

Update: An recent update to FinalBuilder 7.0 now supports DUnit. It's through its own XMLTestrunner.pas, which is under the FinalBuilder Directory after install.
This runner outputs the test results in the same format as NUnit. It then integrates really well into FinalBuilder Server.

蓝戈者 2024-08-29 13:26:58

您正在描述我们正在慢慢发展的设置。

  • DUnit 测试使用 TextTestRunner 单元中定义的 TTextTestListener 编译为控制台应用程序。
  • CI 服务器是一个 cmd 脚本,用于构建所有项目并执行所有测试。
  • 测试的输出通过管道传送到文件。

解决方案可能是让 AQTime 配置这些控制台应用程序,同时仍然能够将结果通过管道传输到随后可以解析的文件?!

另一个解决方案可能是实现您自己的 TestListener 对象,并让该对象将测试结果写入事件日志、直接写入日志文件、数据库或任何您喜欢的地方,并由 FinalBuilder 拾取。

你的项目文件中不会有这样的东西,而是

  Application.Initialize;
  if System.IsConsole then TextTestRunner.RunRegisteredTests
  else GUITestRunner.RunRegisteredTests;

会变成这样的东西

  Application.Initialize;
  if System.IsConsole then OurEventLogTestRunner.RunRegisteredTests
  else GUITestRunner.RunRegisteredTests;

You are kind of describing the setup we are slowly evolving to.

  • DUnit tests are compiled as console applications using the TTextTestListener defined in TextTestRunner unit.
  • CI server is a cmd script that builds all projects and executes all tests.
  • The output of the tests are piped to a file.

A solution might be to have AQTime profile these console applications while still be able to pipe the results to a file that can be parsed afterwards?!

Another solution might be to implement your own TestListener object and have that object write the testresults to the eventlog, directly to a logfile, a database or wherever you like and have this picked up by FinalBuilder.

Instead of having something like this in your project file

  Application.Initialize;
  if System.IsConsole then TextTestRunner.RunRegisteredTests
  else GUITestRunner.RunRegisteredTests;

it would become something like this

  Application.Initialize;
  if System.IsConsole then OurEventLogTestRunner.RunRegisteredTests
  else GUITestRunner.RunRegisteredTests;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文