我在 Nunit 测试中有以下代码...
string url = "";
url = @"http://localhost/ClientPortalDev/Account/LogOn";
ieStaticInstanceHelper = new IEStaticInstanceHelper();
ieStaticInstanceHelper.IE = new IE(url);
ieStaticInstanceHelper.IE.TextField(Find.ById("UserName")).TypeText("abc");
ieStaticInstanceHelper.IE.TextField(Find.ById("Password")).TypeText("defg");
ieStaticInstanceHelper.IE.Button(Find.ById("submit")).Click();
ieStaticInstanceHelper.IE.Close();
在 Dev10(visual studio 10) 中右键单击项目并选择 [Test With][NUnit 2.5],此测试代码运行没有问题。我已经安装了 TestDriven。从C:\Program Files (x86)\NUnit 2.5.5\bin\net-2.0\nunit.exe"打开NUnit,然后打开我的test dll,在NUnit Errors and failures中报如下文字
... LoginAsWellKnownUserShouldSucceed:
System.Runtime.InteropServices.COMException : Error HRESULT E_FAIL has been returned from a call to a COM component.
顺便说一句...在Dev10中右键单击源cs文件并选择运行测试,...也可以。上面的测试实际上是 TechTalk.SpecFlow 1.3 步骤的一部分,我安装了 NUnit 2.5.5.10112,我安装了 Watin 20.20,我的测试 dll 有以下 App.config
开始尖括号已被删除......如何你让xml显示在
configuration>
configSections>
sectionGroup name="NUnit">
section name="TestRunner" type="System.Configuration.NameValueSectionHandler"/>
/sectionGroup>
/configSections>
NUnit>
TestRunner>
add key="ApartmentState" value="STA" />
/TestRunner>
/NUnit>
appSettings>
add key="configCheck" value="12345" />
/appSettings>
/configuration>
以前有人打过这个吗?NUnit 测试显然在 TestDriven 的 NUnit 2.5.5 中运行,但在从 Dev10 和 TestDriven 之外运行 NUnit 2.5.5 时却没有?