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

时间:2021-05-25 15:17:18

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."

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

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

是否有可以下载NUnit 2.4.8的扩展名?如果是这样,我可以从哪里下载?

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?

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

Thanks

谢谢

9 个解决方案

#1


12  

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.

现在最简单的方法是在Visual Studio库中安装此ASP.NET MVC NUnit扩展。好的部分是这个扩展可以随着时间的推移更新,所以你将拥有最新的nunit mvc模板。

#2


8  

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.

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

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

是的,没有更多的手动步骤(除非你真的想)。

#3


5  

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).

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

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

然后我根据Craig Stuntz的建议运行VWDExpress / setup(来自%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.

注意:我之前已从此处添加了注册表设置,但将它们应用于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:

为方便起见,以下是与ASP.NET MVC测试框架集成演练文章的不同之处:

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)

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

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)

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

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

步骤4.运行VWDExpress / setup而不是devenv / setup

#4


3  

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.

非常感谢!我有一些皱纹,因为我只有MVC2和VWD express 2010.所以在前面的文章和指针中假设的各种各样的东西都不太合适。

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.

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

  1. Back-up your registery
  2. 备份你的注册
  3. Unzip the nunitRTM.zip file from 1.
  4. 从1解压缩nunitRTM.zip文件。
  5. 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)
  6. 您可以运行命令文件,它不会查找VWDexpress 2010;所以仔细看看你需要多少修理或手动操作(见下面的步骤)
  7. Copy the template (.ZIP) files to C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\VWDExpress\ProjectTemplates ... Csharp\test and VisualBasic\test
  8. 将模板(.ZIP)文件复制到C:\ Program Files \ Microsoft Visual Studio 10.0 \ Common7 \ IDE \ VWDExpress \ ProjectTemplates ... Csharp \ test和VisualBasic \ test
  9. I made two registry update files: Csharp\NUnitExpress2010.reg and VisualBasic\NUnitExpress2010.reg; from the Csharp\NUnitExpress.reg and VisualBasic\NUnitExpress.reg files (respectively).
  10. 我制作了两个注册表更新文件:Csharp \ NUnitExpress2010.reg和VisualBasic \ NUnitExpress2010.reg;来自Csharp \ NUnitExpress.reg和VisualBasic \ NUnitExpress.reg文件(分别)。
  11. 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"
  12. 主要区别在于使用注册表项:HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft ** VWDExpress **** 10.0 **** MVC2 ** \ TestProjectTemplates注册表项的含义包括在:“ASP.NET MVC测试框架集成”
  13. Update the reistry: regedit.exe /s "Visual Basic\NUnitExpress2010.reg" (e.g.)
  14. 更新reistry:regedit.exe / s“Visual Basic \ NUnitExpress2010.reg”(例如)
  15. Run set-up for Visual Web Designer: C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\VWDExpress.exe" /setup
  16. 运行Visual Web Designer的设置:C:\ Program Files \ Microsoft Visual Studio 10.0 \ Common7 \ IDE \ VWDExpress.exe“/ setup
  17. Fire-up VWD express and open a new project -- There were the nUnit templates.
  18. Fire-up VWD表达并开启一个新项目 - 有nUnit模板。

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

我发现它很乏味,仍然坚持下去,这是值得的。

#5


1  

In VWD Express, use

在VWD Express中,使用

VWDExpress /setup

in lieu of

替代

devenv /setup

#6


1  

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

要快速测试,请尝试xUnit(此处有更多详细信息)。如果它有效,那么继续挖掘NUnit集成。

#7


1  

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

我刚刚发现了一篇博客文章,也解决了这个问题:NUnit VWD Express MVC设置«编码器生活

#8


0  

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

你安装了完整的.net 2.0 NUnit:http://www.nunit.org/index.php?p = download

#9


0  

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

我一直在努力同样的事情。我最后完成的是我接受了ASP.NET MVC团队创建的单元测试(在安装程序中找到),将其与您提到的页面提供的模板混合在一起瞧!它的效果非常好:D

You can download the whole package here

你可以在这里下载整个包

Best regards, Matthias.

最好的问候,马蒂亚斯。

#1


12  

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.

现在最简单的方法是在Visual Studio库中安装此ASP.NET MVC NUnit扩展。好的部分是这个扩展可以随着时间的推移更新,所以你将拥有最新的nunit mvc模板。

#2


8  

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.

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

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

是的,没有更多的手动步骤(除非你真的想)。

#3


5  

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).

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

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

然后我根据Craig Stuntz的建议运行VWDExpress / setup(来自%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.

注意:我之前已从此处添加了注册表设置,但将它们应用于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:

为方便起见,以下是与ASP.NET MVC测试框架集成演练文章的不同之处:

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)

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

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)

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

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

步骤4.运行VWDExpress / setup而不是devenv / setup

#4


3  

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.

非常感谢!我有一些皱纹,因为我只有MVC2和VWD express 2010.所以在前面的文章和指针中假设的各种各样的东西都不太合适。

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.

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

  1. Back-up your registery
  2. 备份你的注册
  3. Unzip the nunitRTM.zip file from 1.
  4. 从1解压缩nunitRTM.zip文件。
  5. 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)
  6. 您可以运行命令文件,它不会查找VWDexpress 2010;所以仔细看看你需要多少修理或手动操作(见下面的步骤)
  7. Copy the template (.ZIP) files to C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\VWDExpress\ProjectTemplates ... Csharp\test and VisualBasic\test
  8. 将模板(.ZIP)文件复制到C:\ Program Files \ Microsoft Visual Studio 10.0 \ Common7 \ IDE \ VWDExpress \ ProjectTemplates ... Csharp \ test和VisualBasic \ test
  9. I made two registry update files: Csharp\NUnitExpress2010.reg and VisualBasic\NUnitExpress2010.reg; from the Csharp\NUnitExpress.reg and VisualBasic\NUnitExpress.reg files (respectively).
  10. 我制作了两个注册表更新文件:Csharp \ NUnitExpress2010.reg和VisualBasic \ NUnitExpress2010.reg;来自Csharp \ NUnitExpress.reg和VisualBasic \ NUnitExpress.reg文件(分别)。
  11. 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"
  12. 主要区别在于使用注册表项:HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft ** VWDExpress **** 10.0 **** MVC2 ** \ TestProjectTemplates注册表项的含义包括在:“ASP.NET MVC测试框架集成”
  13. Update the reistry: regedit.exe /s "Visual Basic\NUnitExpress2010.reg" (e.g.)
  14. 更新reistry:regedit.exe / s“Visual Basic \ NUnitExpress2010.reg”(例如)
  15. Run set-up for Visual Web Designer: C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\VWDExpress.exe" /setup
  16. 运行Visual Web Designer的设置:C:\ Program Files \ Microsoft Visual Studio 10.0 \ Common7 \ IDE \ VWDExpress.exe“/ setup
  17. Fire-up VWD express and open a new project -- There were the nUnit templates.
  18. Fire-up VWD表达并开启一个新项目 - 有nUnit模板。

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

我发现它很乏味,仍然坚持下去,这是值得的。

#5


1  

In VWD Express, use

在VWD Express中,使用

VWDExpress /setup

in lieu of

替代

devenv /setup

#6


1  

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

要快速测试,请尝试xUnit(此处有更多详细信息)。如果它有效,那么继续挖掘NUnit集成。

#7


1  

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

我刚刚发现了一篇博客文章,也解决了这个问题:NUnit VWD Express MVC设置«编码器生活

#8


0  

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

你安装了完整的.net 2.0 NUnit:http://www.nunit.org/index.php?p = download

#9


0  

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

我一直在努力同样的事情。我最后完成的是我接受了ASP.NET MVC团队创建的单元测试(在安装程序中找到),将其与您提到的页面提供的模板混合在一起瞧!它的效果非常好:D

You can download the whole package here

你可以在这里下载整个包

Best regards, Matthias.

最好的问候,马蒂亚斯。