MbUnit 设置和拆卸线程安全吗?
第一次发海报,潜伏已久。我想是时候开始积极参与了。这是我整个周末都在寻找答案的问题。
我正在使用 Selenium 和 MbUnit 编写一堆验收测试,并使用 MbUnit 提供的 DegreeOfParallelism 属性。
我的 Setup 和 Teardown 方法分别启动一个新会话并销毁一个 selenium 会话,基于该方法是在将要调用的测试即将运行的上下文中隔离运行的假设。
但是,我发现 Teardown 方法不能保证在正确的上下文中运行,从而导致正在运行的另一个测试的状态发生变化。这表现为随机测试的 Selenium 会话被关闭。如果我简单地在我的测试主体上添加代码(都是 1-liner)的前缀和后缀,一切都会正常工作。
有什么方法可以确保安装和拆卸方法不会在不正确的上下文/线程中运行?
提前致谢。
First time poster, long time lurker. Figured it's about time I start getting actively involved. So here's a question I've spend all weekend trying to find an answer to.
I'm working on writing a bunch of acceptance tests using Selenium and MbUnit, using the DegreeOfParallelism attribute that MbUnit offers.
My Setup and Teardown methods respectively starts a new and destroys a selenium session, based on the assumption that the method is run in isolation of the context where the test that's gonna be invoked, is about to be run.
However, I'm seeing something that the Teardown method is not guaranteed to be run in the correct context, resulting in the state of another test, which is being run, to be changed. This is manifesting itself as the Selenium session of a random test gets shut down. If I simply prefix and suffix my test bodies with the code(Both 1-liners), everything works correctly.
Is there any way to ensure that the Setup and Teardown methods does not run in the incorrect context/thread?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论