我收到以下异常,当我尝试运行SpecFlow测试:NUnit的,华廷SpecFlow和STA线程错误
的CurrentThread需要有它的ApartmentState设置为ApartmentState.STA能够自动的Internet Explorer。
我已经添加在App.config中下面的代码:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="NUnit">
<section name="TestRunner" type="System.Configuration.NameValueSectionHandler"/>
</sectionGroup>
</configSections>
<NUnit>
<TestRunner>
<!-- Valid values are STA,MTA. Others ignored. -->
<add key="ApartmentState" value="STA" />
</TestRunner>
</NUnit>
</configuration>
我使用VS 2010,并迫使我的应用程序3.5版本上运行。
我也在使用nUnit工具的GUI显示!
哦是的,我有这个代码由于某种原因StackOverflow没有显示它。即使使用XML配置,我也遇到了同样的错误! – azamsharp 2011-03-09 14:09:50
似乎只有在nUnit GUI模式下运行测试时才会出现错误。我只用了TestDriven.NEt,它的功能就像一个魅力!谢谢! – azamsharp 2011-03-09 14:44:22