开发者

BDD with Machine.Specifications in Visual Studio 2010

开发者 https://www.devze.com 2023-01-04 16:44 出处:网络
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

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 wh开发者_JS百科atever 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.)


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消