【发布时间】:2017-05-05 02:47:33
【问题描述】:
要并行运行测试,您不能按原样使用 FeatureContext(例如:FeatureContext.Current.FeatureInfo.Title)。 所以你必须像文档状态 http://specflow.org/documentation/Parallel-Execution/
那样注入它但是,如果我在 [BeforeFeature] 钩子中使用 FeatureContext,它必须是一个静态方法,根据:https://github.com/techtalk/SpecFlow/wiki/Hooks
举例来说,我有这个 Hook 在不并行运行时可以正常工作:
[BeforeFeature]
internal static void BeforeFeature()
{
// Some code here
string title = FeatureContext.Current.FeatureInfo.Title;
// More code here
}
我该如何解决?
谢谢!
【问题讨论】:
标签: specflow