Visual Studio 2010 中的 BDD 与 Machine.Specifications

发布于 2024-09-07 03:14:43 字数 362 浏览 2 评论 0原文

我开始掌握 BDD 和 MSpec,但我仍然对无法调试测试/规范以及必须离开 IDE 转到 html 报告文件感到困扰查看结果。

目前,我有一个配置为运行 mspec.exe $(TargetFileName) --html “$(ProjectDir)Report.html” 的构建后事件,但必须有更好的方法来执行此操作。

有谁知道任何好的加载项、测试运行程序或任何可以让我

  1. 调试测试的东西,而不是仅仅运行它们,
  2. 在 Visual Studio 中以良好的方式显示测试结果

(脚注:我在 Windows 7 上运行 VS2010 Professional,如果这很重要。)

I'm beginning to get the grips of BDD and MSpec, but I'm still really bugged by the fact that I'm unable to debug my tests/specs, and that I have to leave the IDE to go to a html report file to see the results.

Currently, I have a post build event configured to run mspec.exe $(TargetFileName) --html “$(ProjectDir)Report.html”, but there must be some better way to do this.

Does anyone know any good add-ins, test runners or whatever that will let me

  1. debug tests, instead of just running them
  2. show the test results in a nice way inside Visual Studio

(Footnote: I'm running VS2010 Professional on Windows 7, if that matters.)

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

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

发布评论

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

评论(1

雪落纷纷 2024-09-14 03:14:43

基本上有三个选项:

  1. 您可以在以下位置设置自定义工具:
    工具|要启动的外部工具
    mspec.exe 与当前项目的
    运行上下文的程序集和
    生成 HTML 报告。

  2. 安装TestDriven.Net
    确保
    Machine.Specifications.dll.tdnet

    Machine.Specifications.TDNetRunner.dll
    位于您项目的 MSpec 副本中。
    然后您可以运行并调试您的
    上下文菜单中的上下文:“运行
    测试”、“运行方式 |调试器”,无需进一步安装。

    这里有一个MSpec 文件夹的示例
    看起来像我的所有项目。

  3. 如果您使用 ReSharper 4.1、4.5、5.0
    或最新的 5.1 EAP(== beta)
    每个都有跑步者
    版本。

    ZIP 下载
    包含安装的批处理文件
    每个各自的跑步者
    ReSharper 的版本。 ReSharper 的
    单元测试支持非常好
    UI 方面广泛
    小部件/快捷方式支持、报告
    树视图和调试。

    如果你是
    您还可以分析 dotTrace 用户
    就在 Visual Studio 中。
    dotCover(另一个 JetBrains 产品)
    允许您计算代码
    MSpec 的覆盖率结果
    运行。

    除此之外,你还可以得到
    ReSharper 提供的所有出色的编码和导航功能。

请注意,只有第一个选项会生成 HTML 报告,因为 TestDriven.Net 和 ReSharper 运行程序都不支持 HTML 报告生成。从我的角度来看,这不是问题,因为 TD.Net 和 ReSharper 运行程序通过 Visual Studio UI 提供了相当完整的报告机制。

另一个可能有效的选择(我自己没有使用过)是利用 MSpec 的 Gallio 支持。 Gallio 是多个测试框架的运行程序/框架;它也可能支持使用 MSpec 进行调试运行。如果您对 Gallio 支持有疑问,请联系 @smaclell

There are basically three options you have:

  1. You can set up a custom tool in
    Tools | External Tools to start
    mspec.exe with the current project's
    assembly to run the contexts and
    generate the HTML report.

  2. Install TestDriven.Net and
    ensure that
    Machine.Specifications.dll.tdnet
    and
    Machine.Specifications.TDNetRunner.dll
    are in your project's copy of MSpec.
    You can then run and debug your
    contexts from the context menu: "Run
    Tests", "Run With | Debugger" without further installation.

    There's an example of what the MSpec folder
    looks like for all of my projects.

  3. If you use ReSharper 4.1, 4.5, 5.0
    or the latest 5.1 EAP (== beta)
    there are runners for each of these
    versions.

    The ZIP download
    contains batch files that install
    the runner for each respective
    version of ReSharper. ReSharper's
    unit test support is pretty
    extensive in terms of UI
    widgets/shortcut support, the reporting
    tree view and debugging.

    If you're
    a dotTrace user you can also profile
    right from within Visual Studio.
    dotCover (another JetBrains product)
    allows you to calcualate code
    coverage results from your MSpec
    runs.

    On top of that, you get
    all the nice coding and navigation features that ReSharper provides.

Be aware that only the first option will generate the HTML report as both the TestDriven.Net and ReSharper runners do not support HTML report generation. From my point of view this isn't an issue since the TD.Net and ReSharper runners offer fairly complete reporting mechanisms through the Visual Studio UI.

Another option that might work (I haven't used it myself) is to leverage the Gallio support that MSpec has. Gallio is a runner/framework for several testing frameworks; it might as well support debug runs with MSpec. Contact @smaclell if you have questions about Gallio support.

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