什么单元测试框架可以满足我的要求?

发布于 2024-11-28 21:44:57 字数 968 浏览 2 评论 0原文

这就是我在高层次上寻找的一切:

  1. 在 Visual Studio 2008 中运行单元测试的能力
  2. 与某些代码覆盖工具的兼容性
  3. 具有行测试功能(如 MBUnit 的 RowTestAttribute
  4. 能够与 Team City

我以为我已经在 xUnit.net 1.8、resharper 6.0 和 dotCover 1.1.1 中找到了这个。然而,在花了将近一天的时间摆弄这些东西之后,我发现了这个设置的这些主要问题:

我已成功使用 MSTest ReSharper 可以做我需要的一切,除了行测试,但似乎生活可以使用一些更先进的测试框架会更好。

我已经开始关注 Gallio,但我希望有人可以节省我一些时间并推荐一款获胜的游戏在我浪费更多时间探索之前组合。

您成功使用过哪种组合?

This is all i'm looking for at a high level:

  1. The ability to run unit tests from within visual studio 2008
  2. Compatibility with some code coverage tool
  3. A unit testing framework with a row testing feature like MBUnit's RowTestAttribute
  4. Ability to integrate with Team City

I thought i had found this with xUnit.net 1.8, resharper 6.0, and dotCover 1.1.1. However, after investing almost a day with messing around with this stuff i've found these major issues with this setup:

  • Theory tests (row tests) are not fully supported in Resharper - more info
  • dotCover basically does not work with xUnit

I was successfully using MSTest with ReSharper to do everything i need but the row tests, but it seems that life could be much better with some of the more advanced testing frameworks.

I've started looking at Gallio, but I'm hoping that someone can save me some time and recommend a winning combination before I waste any more time exploring.

What combination have you used successfully?

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

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

发布评论

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

评论(3

攒一口袋星星 2024-12-05 21:44:57

我建议您使用 NUnit

  • 完全集成
  • 您可以使用 TestDriven.NETReSharper 与 Visual Studio PartCover code>、SonarNCover 1.5.8 free 作为代码覆盖工具
  • TestCase 属性来传递不同的参数集(ReSharper 完美支持此属性)
  • 团队城市 支持内置于

TestCase 属性的示例中

 [Test]
 [TestCase(1)]
 [TestCase(2)]
 [TestCase(3)]
 public void TestMe(int param)
 {
    Assert.That(param > 0);
 }

I would suggest you to use NUnit:

  • You can use TestDriven.NET or ReSharper to have full integration with Visual Studio
  • PartCover, Sonar, NCover 1.5.8 free as code coverage tool
  • TestCase attribute to pass different set of parameters (ReSharper supports this attribute perfectly)
  • Team City support is built in

An example for TestCase attribute

 [Test]
 [TestCase(1)]
 [TestCase(2)]
 [TestCase(3)]
 public void TestMe(int param)
 {
    Assert.That(param > 0);
 }
書生途 2024-12-05 21:44:57
  1. 与 IDE 集成:开箱即用且免费 => MS测试。如果您愿意下载和使用,有大量的测试运行程序。NUnit 是最古老的。如果您愿意付费,您可以使用 resharper、test-driven.net 和其他插件。 Resharper 在测试运行程序中拥有自己的捆绑包 - 这就是您看到这些棘手问题的原因。现在,如果您想运行和调试,那么您的选择将会减少更多。运行就像将程序设置为调试单元测试运行程序 exe 一样简单。底线:除 MSTest 之外的任何集成都必须付费/下载。
  2. 与代码覆盖率的兼容性:再次开箱即用并且免费 => MS测试。付费:NCover 将与任何 exe 集成...所以不是一个限制(但恕我直言,成本有点太多)。现在也出现了其他一些问题——Jetbrains 推出了他们自己的变体,我假设他们自己的产品之间将具有兼容性。
  3. RowTests :NUnit 有这个。虽然我认为它是从 xUnit 或 MBUnit 借用的,但我忘记了。 MSTest 支持将此作为可下载的扩展。
  4. 与 Team City 集成:请参阅他们的页面:似乎仅适用于 NUnit 和 MSTest 。我亲自用 NUnit 检查过它。使用最小的配置工作。
  1. Integration with IDE: Out of the box and free => MSTest. If you're willing to download and use, there is a plethora of test runners.. NUnit being the oldest. If you're willing to pay, you have resharper, test-driven.net and the other add-ins. Resharper has its own bundled in test runner - so that's why you see those niggling issues. Now if you want to run and debug, then your options would be cut down even more. Running is as easy as setting the program to debug as your unit test runner exe. Bottomline: Integration for anything other than MSTest, has to be paid for/downloaded.
  2. Compatibility with code coverage: Again out of the box and free => MSTest. Paid: NCover will integrate with any exe... so not a constraint (but costs a bit too much IMHO). There are others too cropping up now - with Jetbrains throwing their own variant, I'm assuming compatibility will be a given among their own products.
  3. RowTests : NUnit has this. Although I think it was borrowed from xUnit or MBUnit, I forget. MSTest supports this as a downloadable extension.
  4. Integrate with Team City : See their page: Seems to work with NUnit and MSTest only. I have personally checked it out with NUnit.. worked with minimal configuration.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文