我已经在我的开发环境中运行了一个简单的 WatiN 网络测试,并试图让它在 TFS 构建服务器上运行。 WatiN 正在触发异常:
System.Threading.ThreadStateException: The CurrentThread needs to have it's ApartmentState set to ApartmentState.STA to be able to automate Internet Explorer.
测试运行器 VSTestHost 应该默认使用 STA 线程。我还尝试通过 .testrunconfig 文件明确强制它进入 STA。 WatiN还是不高兴。 我在 Windows Server 2008 上使用 Visual Studio/TFS 2008。
有没有其他人遇到过这个问题并找到了解决方案?
最佳答案
您可能想检查/使用 WatiN 测试方法的 [STAThread]
属性
关于visual-studio-2008 - 在 VSTestHost 下运行 WatiN 测试的线程问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/927064/