nunit2任务,NAnt,Watin-公寓状态STA错误

nunit2任务,NAnt,Watin-公寓状态STA错误,nunit,nant,watin,Nunit,Nant,Watin,我正在探索NUnit和Nant驱动的WatIN自动化框架。我在App.config中设置了Apartmentstate <NUnit> <TestRunner> <!-- WatiN can only host IE in STA mode --> <add key="ApartmentState" value="STA"/> </TestRunner> </NUnit> 我还在

我正在探索NUnit和Nant驱动的WatIN自动化框架。我在App.config中设置了Apartmentstate

<NUnit>
    <TestRunner>
      <!-- WatiN can only host IE in STA mode -->
      <add key="ApartmentState" value="STA"/>
    </TestRunner>
</NUnit>

我还在测试类中设置了[TestFixture,RequirestTA]。当我使用nunit控制台testrunner或nunit GUI runner时,这工作得非常好

在NAnt中使用Nunit2 runner会引发此异常

[nunit2]:[DEBUG]CurrentThread需要将其ApartmentState设置为ApartmentState.STA才能自动执行Internet Explorer

我如何解决这个问题

谢谢
詹加

我也有类似的问题。在从nant目标调用nunit-console.exe时,我可以通过添加/nothread参数来修复它

例如:

<exec verbose="true" 
    workingdir="${project::get-base-directory()}\build"
    program="tools\nunit\nunit-console.exe" basedir="${project::get-base-directory()}">

    <arg value="${ua-testproject.name}" />
    <arg value="/nothread" />
    <arg value="/xml:${ua-tests.report}" />
</exec>

您是否尝试过[TestFixture(ApartmentState=ApartmentState.STA)]并发现两者都不起作用:(.仍在调查中)。