如何将 NUnit 作为 ASP.NET MVC 的测试框架选项添加到 Visual Web Developer 2008 Express?

发布于 2024-07-15 08:06:55 字数 928 浏览 14 评论 0原文

根据 专业 ASP.NET MVC 1.0,第 8 页,“如果您使用 VS 2008 标准版或 Visual Web Developer 2008 Express,则需要下载并安装 ASP 的 NUnit、MBUnit 或 XUnit 扩展.NET MVC 以便显示 [创建单元测试项目] 对话框。”

NUnit 2.4.8 有这样的扩展可供下载吗? 如果可以的话我可以从哪里下载?

如果没有,我该如何设置? 我查看了 ASP.Net MVC 和 nUnit 问题和文章 如何:在 Visual Studio 中添加自定义 MVC 测试框架ASP.NET MVC 测试框架集成演练。 但它们都涉及运行 devenv /setup,这似乎不适用于 Visual Web Developer 2008 Express。 有人获得了与 NUnit 和 VWD Express 一起使用的“创建单元测试项目”对话框吗? 为何如此?

谢谢

According to Professional ASP.NET MVC 1.0, page 8, "If you are using VS 2008 Standard Edition or Visual Web Developer 2008 Express you will need to download and install the NUnit, MBUnit or XUnit extensions for ASP.NET MVC in order for [the Create Unit Test Project] dialog to be shown."

Is there such an extension available to download for NUnit 2.4.8? If so where can I download it from?

If not, how can I set it up? I looked at the ASP.Net MVC and nUnit question and the articles How to: Add a Custom MVC Test Framework in Visual Studio and ASP.NET MVC Test Framework Integration Walkthrough. But they all refer to running devenv /setup which doesn't seem to be available for Visual Web Developer 2008 Express. Has anyone gotten the Create Unit Test Project dialog working with NUnit and VWD Express? How so?

Thanks

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

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

发布评论

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

评论(9

凯凯我们等你回来 2024-07-22 08:06:55

The easiest way now in 2011 is to install this ASP.NET MVC NUnit extension from the Visual Studio gallery. The nice part is that this extension can be updated over time so you will have the latest nunit mvc template.

懒猫 2024-07-22 08:06:55

我刚刚发现这个 更新了 ASP.Net MVC 1.0 RTM 的 NUnit 模板,其中包括一个用于为 VWD Express 设置 NUnit 测试框架模板的 cmd 文件。

是的,不再需要手动步骤(除非您真的想要)。

I just found this Updated NUnit Templates for ASP.Net MVC 1.0 RTM which includes a cmd file to setup the NUnit test framework templates for VWD Express.

Yay, no more manual steps (unless you really want to).

魄砕の薆 2024-07-22 08:06:55

编辑:有一个更简单的解决方案下面

我得到了与 NUnit 和 Visual Web Developer Express 一起使用的“创建单元测试项目”对话框。 我必须添加一个 NUnit 测试模板到以下位置:%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\VWDExpress\ProjectTemplates\CSharp\Test\1033(我必须创建Test\1033 子文件夹)。

然后,我按照 Craig Stuntz 的建议(来自 %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE)运行 VWDExpress /setup

它成功了!

注意:我之前已从 此处,但将它们应用于 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VWDExpress\9.0\MVC\TestProjectTemplates

为了您的方便,以下是与 ASP.NET MVC 测试框架集成演练文章:

步骤 1. 将模板 zip 文件复制到 %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\VWDExpress\ProjectTemplates \CSharp\Test\1033(注意 VWDExpress 文件夹)

步骤 2. 在合并注册表文件之前,编辑它们以指向以下位置的适当位置:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VWDExpress\9.0 \MVC\TestProjectTemplates(注意 VWDExpress 键)

第 4 步:运行 VWDExpress /setup 而不是 devenv /setup

Edit: There's an easier solution below.

I got the Create Unit Test Project dialog working with NUnit and Visual Web Developer Express. I had to add an NUnit test template to the following location: %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\VWDExpress\ProjectTemplates\CSharp\Test\1033 (I had to create the Test\1033 subfolders).

Then I ran VWDExpress /setup per Craig Stuntz's recommendation (from %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE).

And it worked!

Note: I had previously added registry settings from here but applied them to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VWDExpress\9.0\MVC\TestProjectTemplates.

For your convenience, here are the differences from the ASP.NET MVC Test Framework Integration Walkthrough article:

Step 1. Copy the template zip files to %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\VWDExpress\ProjectTemplates\CSharp\Test\1033 (note the VWDExpress folder)

Step 2. Before merging the registry file(s), edit them to point to the appropriate location under: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VWDExpress\9.0\MVC\TestProjectTemplates (note the VWDExpress key)

Step 4. Run VWDExpress /setup instead of devenv /setup

临风闻羌笛 2024-07-22 08:06:55

谢谢这一切,太棒了! 我有一些问题,因为我只有 MVC2 和 VWD express 2010。所以前面的文章和指针中假设的各种事情并不太有效。

我概述了对我有帮助的内容,从以下基础开始:“更新了 ASP.Net MVC 1.0 RTM 的 NUnit 模板”文章。

  1. 备份您的注册表
  2. 1
  3. 您可以运行命令文件,它不会查找VWDexpress 2010; 因此请仔细查看需要修复或手动执行多少操作(请参阅以下步骤)
  4. 将模板 (.ZIP) 文件复制到 C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\VWDExpress\ProjectTemplates .. Csharp\test 和 VisualBasic\test
  5. 我制作了两个注册表更新文件:Csharp\NUnitExpress2010.reg 和 VisualBasic\NUnitExpress2010.reg; 来自 Csharp\NUnitExpress.reg 和 VisualBasic\NUnitExpress.reg 文件(分别)。
  6. 主要区别在于使用注册表项: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft**VWDExpress****10.0****MVC2**\TestProjectTemplates
    注册表项含义包含在:“ASP.NET MVC 测试框架集成"
  7. 更新注册表:regedit.exe /s“Visual Basic\NUnitExpress2010.reg”(例如)
  8. 运行 Visual Web Designer 的设置:C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\VWDExpress.exe" /setup
  9. 启动 VWD Express 并打开一个新项目——里面有 nUnit 模板,

我觉得很乏味,但坚持下去是值得的。

Thanks all that's great! I had a few wrinkles, because I only have MVC2 with VWD express 2010. So various things assumed in the earlier articles and pointers don't quite work out.

I made an outline for what helped me, starting with the base of: the templates and .CMD file in the "Updated NUnit Templates for ASP.Net MVC 1.0 RTM" article.

  1. Back-up your registery
  2. Unzip the nunitRTM.zip file from 1.
  3. You can run the command file, it doesn't look for VWDexpress 2010; so look carefully to see how much you need to fix-up or do manually (see following steps)
  4. Copy the template (.ZIP) files to C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\VWDExpress\ProjectTemplates ... Csharp\test and VisualBasic\test
  5. I made two registry update files: Csharp\NUnitExpress2010.reg and VisualBasic\NUnitExpress2010.reg; from the Csharp\NUnitExpress.reg and VisualBasic\NUnitExpress.reg files (respectively).
  6. The main difference is the use registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft**VWDExpress****10.0****MVC2**\TestProjectTemplates
    Registry entry meanings are covered in: "ASP.NET MVC Test Framework Integration"
  7. Update the reistry: regedit.exe /s "Visual Basic\NUnitExpress2010.reg" (e.g.)
  8. Run set-up for Visual Web Designer: C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\VWDExpress.exe" /setup
  9. Fire-up VWD express and open a new project -- There were the nUnit templates.

I found it tedious, still persevere it will be worth it.

幻梦 2024-07-22 08:06:55

在 VWD Express 中,使用

VWDExpress /setup

代替

devenv /setup

In VWD Express, use

VWDExpress /setup

in lieu of

devenv /setup
又爬满兰若 2024-07-22 08:06:55

要进行快速测试,请尝试 xUnit (更多详细信息此处)。 如果有效,则进一步研究 NUnit 集成。

For a quick test, try xUnit (more details here). If it works, then digg further on NUnit integration.

安稳善良 2024-07-22 08:06:55

我刚刚发现一篇博客文章也解决了这个问题: NUnit VWD Express MVC 设置 « 程序员的生活

I just found a blog article that also addresses this issue: NUnit VWD Express MVC setup « A Coders Life

一杯敬自由 2024-07-22 08:06:55

您是否安装了完整的 .net 2.0 NUnit: http://www.nunit.org/ index.php?p=下载

Have you installed the full .net 2.0 NUnit: http://www.nunit.org/index.php?p=download

月隐月明月朦胧 2024-07-22 08:06:55

我也一直在为同样的事情而苦苦挣扎。 我最后所做的是采用 ASP.NET MVC 团队创建的单元测试(在安装程序中找到),将其与您提到的页面提供的模板混合在一起,瞧! 它工作得很好:D

您可以下载整个包 在此致

以最诚挚的问候,
马蒂亚斯.

I've been struggling with that same thing as well. What I've done at the end was I took the unit tests created by the ASP.NET MVC team (found in the installer), mixed it with the templates provided by the pages you've mentioned and voila! It works just great :D

You can download the whole package here

Best regards,
Matthias.

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