我在Visual Studio 2010中有一個解決方案,其中包含一個使用WatiN的測試項目。它還有一個單元測試的測試項目。兩者都使用NUnit作爲框架。我使用Gallio來運行/調試測試。在Visual Studio 2012中調試WatiN UI測試
我試用Visual Studio 2012.我的項目生成的罰款。我可以使用NUnit GUI來運行這兩組測試。測試瀏覽器列出所有測試(單元和UI)。我可以在Visual Studio中運行/調試單元測試。
當我從Visual Studio 2012中運行的UI測試中,我得到一個錯誤:
The CurrentThread needs to have it's ApartmentState set to ApartmentState.STA to be able to automate Internet Explorer.
在我TestFixtureSetup功能以下行出現的錯誤:
browser = new IE(...);
我已經Googled the error並看到很多關於向app.config添加行的建議。奇怪的是我已經有了這些線。
<sectionGroup name="NUnit">
<section name="TestRunner"
type="System.Configuration.NameValueSectionHandler"/>
</sectionGroup>
...
<NUnit>
<TestRunner>
<!-- Valid values are STA or MTA (Others are ignored) -->
<add key="ApartmentState" value="STA" />
</TestRunner>
</NUnit>
有沒有人得到WatiN與Visual Studio 2012中的測試資源管理器一起工作?任何建議讓它工作?有沒有已知的兼容性問題?
我也試着在RC上安裝Gallio,它打破了一些需要一點努力才能解決的問題。我寧願使用集成的測試瀏覽器。
是的 - 這應該在添加[assembly:RequiresSTA]之後工作 –