nunit 不是 vs2008 中可用的测试框架

发布于 2024-07-12 08:50:23 字数 590 浏览 6 评论 0原文

我已经运行 Visual Studio 2008 Team Edition 一段时间了,需要开始使用 nunit。 我加载了 nunit 2.4.8,但 nunit 没有显示为测试框架的选择。 这是您在启动新项目时看到的选择,它询问您是否要设置测试项目以及您希望使用哪个框架(仅显示 Visual Studio 单元测试)。

编辑:我得到的唯一选择是与 VS2008 一起安装的“Visual Studio 单元测试”。 我只在一个新的MVC项目中尝试过。 我会尝试其他一些项目类型,看看我会得到什么选择。 尝试 web 项目和 winforms,单元测试在项目开始时不是一个选项; 这对我来说有点道理。

更新:我在 nuit GUI 界面中找到了一个设置,位于“工具”>“ 选项; 从选项树 IDE 支持 > 视觉工作室。 有一个复选框可启用 Visual Studio 支持。 我以为这是一个本垒打,但检查后,重新启动应用程序,XP等仍然是同样的问题,nunit不是一个测试框架的选项。

我知道这应该有效,正如我所描述的那样,Stephen Walther 在他的教程视频中与 nunit 的 Charlie Poole 一起使用了 nunit。

I have been running Visual Studio 2008 Team Edition for some time now and need to start using nunit. I loaded nunit 2.4.8 but nunit is not showing as a selection for a testing framework. This is the selection you see when starting a new project and it asks if you want to setup a testing project and which framework you wish to use (only displays Visual Studio Unit Test).

EDIT: The only choice I do get is the "Visual Studio Unit Test" the one installed with VS2008. I have only tried it in a new MVC project. I will try in some other project types and see what choices I get. Trying web project and winforms, unit testing isn't an option at the start of the project; which somewhat makes sense to me.

Update: I found a setting in the nuit GUI interface at Tools > Options; from the options tree IDE Support > Visual Studio. There is a checkbox to enable Visual Studio Support. I thought it was a home run, but after checking it, restarting apps, XP, etc. still the same issue where nunit isn't an option as a testing framework.

I know this should work as I described as Stephen Walther used nunit in his tutorial video with Charlie Poole of nunit.

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

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

发布评论

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

评论(7

吃兔兔 2024-07-19 08:50:23

NUnit 目前不提供 Visual Studio 集成。 但是,您可以自己创建以相同方式工作的模板。 对于 NUnit,您可以找到 说明根据这些说明创建的模板。 还有其他人创建的模板,你只需要谷歌搜索即可。

从 Walther/Poole 视频 的评论中,出现了以下内容是用于获取该演示的 NUnit 选项的方法。

The Visual Studio integration is not provided by NUnit currently. However, you can create templates yourself that work the same way. For NUnit, you can find instructions and templates created from those instructions. There are also templates that others have created, you just need to google for them.

From the comments to the Walther/Poole video, this appears to be the method used to get the NUnit option for that demo.

邮友 2024-07-19 08:50:23

我发现我的帖子是重复的: Adding NUnit to the options for ASP.NET MVC测试框架

接受的答案:将 NUnit 添加到 ASP.NET MVC 的选项测试框架

我必须说,我对 Charlie Poole 没有发布适用于 nunit 和 vs2008 的模板感到非常失望。 我真的不想构建自己的模板,并且对模板了解不够,不知道别人提供的模板有多有价值。

这篇文章的最后三个回复(感谢您的回复)说了同样的话,所以我不确定谁会得到接受的答案。

根据MVC网站评论这个< /a> 可能是教程中使用的模板。 像往常一样,主持人没有回应。

I found that my post here is a duplicate: Adding NUnit to the options for ASP.NET MVC test framework

The accepted answer: Adding NUnit to the options for ASP.NET MVC test framework

I must say I am pretty disappointed that Charlie Poole hasn't released a template which works with nunit and vs2008. I really don't wish to build my own and don't know enough about templates to know how worthy one is from someone else.

The last three responses to this post (thank you for the response) say the same thing so I am not sure who will get the accepted answer. laugh

According to the MVC site comments this may be the template used in the tutorial. No response from the presenters, as usual.

阳光下慵懒的猫 2024-07-19 08:50:23

ReSharper 中提供了与 nUnit 的集成测试...(这只是该产品的优良功能之一)我用它所有的时间。

显然它也可以与 TestDriven.NET 一起使用(我没有使用过这个产品)

Integrated testing with nUnit is available in ReSharper...(this is just one of the fine features of this product) I use it all the time.

Apparently it's also available with TestDriven.NET (I haven't used this product)

梦幻之岛 2024-07-19 08:50:23

好吧.. 看起来像是一个MVC 工具好东西.. 不适用于我们其他人。
发现这个链接似乎可以满足您的要求...

ASP.NET MVC 测试框架集成

您需要修改注册表才能将 NUnit 注册为测试框架。 请参见步骤 2。

Alright.. seems like a MVC Tooling goodie.. not available for the rest of us.
Found this link that seems to do what you want...

ASP.NET MVC Test Framework Integration

You need to mess around with the registry to get NUnit registered as a testing framework. See Step 2.

雄赳赳气昂昂 2024-07-19 08:50:23

Stephen Walther 使用的模板可以在这里找到:ASP.Net MVC 测试框架集成。 此链接提供了工作演示,而 Gishu 的链接仅提供了所有注册表魔法。 这些演示已经过时了,在当前状态下实际上没有什么用处,但您可以对其进行修复以满足您的需求。

The template that Stephen Walther used can be found here: ASP.Net MVC Test framework integration. This link provides working demos whereas Gishu's link only provides all the registry magic. The demos are horribly out of date and not practically useful in their current state, but you could fix them up to suit your needs.

吹梦到西洲 2024-07-19 08:50:23

Nunit 不提供内置的 Visual Studio 集成。 您可能可以尝试第三方解决方案。 据我所知,您可以通过在普通类库中添加对 Nunit 库的引用来创建 Nunit 测试。 您可以在 Visual Studio 外部的单独测试运行器中运行测试。

还有其他方法可以将 Team Foundation Server 与 Nunit 集成。 例如,您可以使用自定义构建任务将 Nunit 测试集成到 TFS 构建过程中。

Nunit does not offer built-in Visual Studio integration. There might be 3rd party solutions you can try. As far as I know, you create Nunit tests by adding the references to the Nunit libraries in a normal class library. You run the tests in a separate test runner outside of Visual Studio.

There are other ways to integrate Team Foundation Server with Nunit. For example you can use custom build tasks to integrate the Nunit tests into your TFS build process.

下壹個目標 2024-07-19 08:50:23

这并不重要,因为您所需要做的就是创建一个新的类库项目并添加对 nunit.framework.dll 的引用,然后就可以开始了。

It doesn't really matter as all you need to do is create a new class library project and add a reference to nunit.framework.dll and you are good to go.

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