Asp.net mvc 4 无法使用VS Express 2012 for Web、MVC4、WatiN&;查找或运行集成测试;单元测试
我正在尝试使用VS Express 2012 for Web、MVC4、WatiN和NUnit使“Hello World”WatiN示例正常工作 然而,VisualStudio似乎并不认可该测试。当我在测试方法中单击鼠标右键,然后单击“运行测试”时,除了重新生成(这是干净的)之外,什么都不会发生。“测试资源管理器”中没有显示任何内容 集成测试代码为:Asp.net mvc 4 无法使用VS Express 2012 for Web、MVC4、WatiN&;查找或运行集成测试;单元测试,asp.net-mvc-4,visual-studio-2012,nunit,integration-testing,watin,Asp.net Mvc 4,Visual Studio 2012,Nunit,Integration Testing,Watin,我正在尝试使用VS Express 2012 for Web、MVC4、WatiN和NUnit使“Hello World”WatiN示例正常工作 然而,VisualStudio似乎并不认可该测试。当我在测试方法中单击鼠标右键,然后单击“运行测试”时,除了重新生成(这是干净的)之外,什么都不会发生。“测试资源管理器”中没有显示任何内容 集成测试代码为: using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using N
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NUnit.Framework;
using WatiN.Core;
namespace FootyStatMVC1.Tests
{
[TestFixture]
[RequiresSTA]
public class UnitTest1
{
[Test]
public void TestMethod1()
{
IE ie = new IE("http://www.google.com");
ie.TextField(Find.ByName("q")).TypeText("WatiN");
ie.Button(Find.ByValue("Google Search")).Click();
}
}
}
我已经使用nuget安装了NUnit和WatiN。我还添加了
生成的配置文件名为app.config,如下所示:
<configuration>
<appSettings>
</appSettings>
<connectionStrings></connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<!-- MSM integration testing aug 31st-->
<configSections>
<sectionGroup name="NUnit">
<section name="TestRunner" type="System.Configuration.NameValueSectionHandler"/>
</sectionGroup>
</configSections>
<NUnit>
<TestRunner>
<!-- Valid values are STA or MTA (Others are ignored) -->
<add key="ApartmentState" value="STA" />
</TestRunner>
</NUnit>
</configuration>
为什么测试对VisualStudio是不可见的
提前谢谢
MatVisual Studio 2012不会识别NUnit单元测试夹具。它使用自己的Microsoft测试框架,类似于NUnit,但不同 您正在使用的快速版本甚至无法识别Microsoft测试,因为快速版本中不包含测试运行程序 您最好在Visual Studio之外使用NUnit测试运行程序
遗憾的是,所有其他插入Visual Studio 2012的测试运行程序都不能与Visual Studio 2012 Express配合使用,因为它也不允许使用插件。如果您希望使用Visual Studio中众多集成测试运行程序中的一个,则必须升级。更新:我注意到生成的错误列表中有以下“I”(信息)警告:“找不到元素“NUnit”的架构信息”以及类似的“TestRunner”、“add”、“key”和“value”警告。所有标记均指标记之间的行。为什么VS没有认识到这些?