我收到以下異常,當我嘗試運行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