如何查找未执行的代码

发布于 2024-08-09 02:31:03 字数 477 浏览 6 评论 0原文

您好,

我有一个项目的大量适应性测试(1000+)。随着时间的推移,随着功能的变化,共享设备的出现和消失,我们留下了未使用的孤立代码。但如何找到它呢?

对于那些不知道 Fit 是如何工作的人,您有一个 wiki 页面,其中包含如下内容:

|当用户添加 | 1 |和| 2 |他回来了| 3 |

在运行时映射到这样的方法:

public bool WhenAUserAddsAndHeIsReturned(int first, int second, int expectedResult){

    return ((first + second) == expectedResult)
}

手动查找所有这些映射将是一项苦差事,编写脚本来完成这将是一项漫长而困难的任务。我确信一定有更好的解决方案。

是否有一个实用程序可以在测试运行时监视夹具 dll,然后返回所有未运行的类和方法的列表?

Greetings,

I have a large number of fitnesse tests for a project (1000+). Over time as features change, and shared fixtures come and go we have been left with unused orphaned code. But how to find it?

For those who don't know how fit works, you have a wiki page with a like like this:

| When a User Adds | 1 | and | 2 | He is returned | 3 |

Which is mapped at run time to a method like:

public bool WhenAUserAddsAndHeIsReturned(int first, int second, int expectedResult){

    return ((first + second) == expectedResult)
}

finding all of these mappings by hand would be drudgery, writing a script to do it would be a long and difficult task. Im sure there must be a better solution.

Is there a utility out there that could monitor the fixture dll while the tests are running and then return a list of all classes and methods that were NOT run?

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

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

发布评论

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

评论(3

怎会甘心 2024-08-16 02:31:03

您要查找的关键词是覆盖问题#276829涵盖了适用于您的 C#/.NET 平台的一些选项。

The key word you're looking for is coverage. Question #276829 covers some of the options for your C#/.NET platform.

扎心 2024-08-16 02:31:03

与覆盖率相关的是分析工具。请参阅这篇文章了解 .Net 建议。这些工具会告诉您在执行过程中时间花在哪里,不一定是您的代码没有去的地方,但您可以使用它们来查找死代码。

Related to coverage are profiling tools. See this post for .Net recommendations. These tools tell you where your time is spent during execution, not necessarily when your code didn't go, but you can use them to find the dead code.

软甜啾 2024-08-16 02:31:03

eswald 是对的,覆盖率工具正是您所需要的。我们的 ccNet 构建服务器使用 NCover 运行 Fitnesse 测试(和单元测试),以检查我们在应用程序代码的自动化测试方面做得如何。
这个问题很好地提醒我们检查死灯的覆盖范围报告。

eswald is right, Coverage tool is exactly what you need. Our ccNet build server runs our Fitnesse tests (and unit tests) with NCover to check how well we are doing with automated testing of the application code.
This question a nice reminder to check the coverage reports for dead fixtures.

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