NUnit 无法在 Visual Studio 2010 上运行?

发布于 2024-11-17 06:10:24 字数 742 浏览 4 评论 0原文

我是 NUnit 的新手,今天才下载它,但无法让它与 Visual Studio 一起使用。 (我也是 Visual Studio 的新手) 我正在关注 TekPub 的 Mastering C# 4.0 教程。

屏幕截图:红圈区域内缺少一些东西。侧面应该有一些“绿色的东西”,可以让您双击它并运行 NUnit 测试。
http://dl.dropbox.com/u/20422001/NunitMissing.jpg

正如您在上面的屏幕截图中看到的,NUnit 似乎无法工作......

我错过了什么吗?请指教。谢谢

编辑 这就是它应该的样子。我从视频教程中截取了屏幕截图:

http://dl.dropbox.com/u/ 20422001/nunit.jpg

这是项目文件:

http://dl.dropbox.com/u/20422001/MasteringCSharp.rar

如您所见,我没有“单元测试”选项卡和“单元测试会话”。 。

I'm new to NUnit and I just download it today and I can't get it working with visual studio. (I'm new to Visual Studio as well)
I'm following TekPub's Mastering C# 4.0 tutorial.

Screenshot: Something is missing within the red circle area. There should be some "green thing" on the side that let you double click on it and run the NUnit test.
http://dl.dropbox.com/u/20422001/NunitMissing.jpg

As you can see on the above screenshot, the NUnit seems not working....

Did I miss something? Please advice. Thanks

EDIT
This is how it SHOULD look like. I took a screenshot from the video tutorial:

http://dl.dropbox.com/u/20422001/nunit.jpg

and here is the project files:

http://dl.dropbox.com/u/20422001/MasteringCSharp.rar

As you can see, I don't have "Unit Test" Tab and "Unit Test Session"...

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

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

发布评论

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

评论(3

羞稚 2024-11-24 06:10:24

你没有做错任何事。 NUnit 开箱即用,不直接与 Visual Studio 集成。视频中的屏幕截图似乎正在使用 Resharper 的测试运行程序。

通常,使用 NUnit 进行测试需要您编译测试项目,然后将其加载到 NUnit GUI (nunit.exe) 中,然后可以从那里运行测试。使用 NUnit GUI 时,只要重新编译程序集,项目就会重新加载。 (我有时更喜欢将其放在单独的进程中,因为它不会绑定 Visual Studio 的 UI,但这是一个偏好问题。)

使用 Resharper、TestDriven.net、Galileo 等第三方测试运行程序的额外优势是它允许您直接从 IDE 中运行或调试测试。您可以使用 NUnit 完成同样的事情,方法是将 Visual Studio 配置为附加到 NUnit 并从外部进程调试测试。这篇帖子向您展示了具体方法

You aren't doing anything wrong. Out of the box, NUnit doesn't integrate directly with Visual Studio. The screenshot from the video appears to be using Resharper's test runner.

Typically testing with NUnit requires you to compile your test project and then load it into the NUnit GUI (nunit.exe) where the tests can be run from there. When using the NUnit GUI, the project will reload anytime the assembly is recompiled. (I sometimes prefer having this in a separate process as it doesn't tie up Visual Studio's UI, but that's a matter of preference.)

The added advantage of using a third party test runner like Resharper, TestDriven.net, Galileo, etc is that it allows you to run or debug the tests directly from within the IDE. You can accomplish the same thing using NUnit by configuring Visual Studio to attach to NUnit and debug your tests from the external process. This post shows you how.

卖梦商人 2024-11-24 06:10:24

我还没有看过那个特定的视频,但听起来您需要一个用于 Visual Studio 的 NUnit 测试运行程序。

查看以下内容:

Visual NUnit 2010 - 免费!

TestDriven.net

ReSharper

I haven't seen that particular video, but it sounds like you need an NUnit test runner for Visual Studio.

Check out the following:

Visual NUnit 2010 - free!

TestDriven.net

ReSharper

行至春深 2024-11-24 06:10:24

我的朋友是 JetBrains 的 Resharper - 它是 Visual Studio 的一个付费插件,允许您从 IDE 中运行测试。如果您在 VS 中工作很长时间,强烈推荐。

当然,由于您刚刚开始,您可以使用 NUnit GUI 来运行测试。您还可以将其设置为在每次构建后运行测试。
工具>设置>测试装载机>组件重新加载。选中“重新运行上次运行的测试”。应用更改

That my friend is JetBrains' Resharper - it's a paid add-in to Visual Studio that allows you to run tests from within the IDE. Highly recommended if you're working for a prolonged period in VS.

Of course since you're just starting out, you could use the NUnit GUI to run your tests. You can also set it to run tests after each build.
Tools > Settings > Test Loader > Assembly Reload. Check "Re-Run last tests run". Apply changes

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