gpt4 book ai didi

visual-studio-2008 - 在 VSTestHost 下运行 WatiN 测试的线程问题

转载 作者:行者123 更新时间:2023-11-28 20:12:56 25 4
gpt4 key购买 nike

我已经在我的开发环境中运行了一个简单的 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 线程。我还尝试通过 .testrunco​​nfig 文件明确强制它进入 STA。 WatiN还是不高兴。我在 Windows Server 2008 上使用 Visual Studio/TFS 2008。

有没有其他人遇到过这个问题并找到了解决方案?

最佳答案

您可能想检查/使用 WatiN 测试方法的 [STAThread] 属性

关于visual-studio-2008 - 在 VSTestHost 下运行 WatiN 测试的线程问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/927064/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com