执行 Specflow 功能的顺序
我可以以某种方式强制在我的功能和场景中或在从 Specflow 功能文件生成的 Nunit 测试中强制执行顺序吗? 如果我可以首先测试所有数据输入功能,然后测试数据修改和数据删除功能,那就太好了。
Can I somehow force execution order in my features and scenarios or in Nunit tests which are generated from specflow feature file?
It would be nice if I could first test all my data entering features, and than data modifying and than data deleting features.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为这对于您选择的测试运行者来说更是一个问题。 SpecFlow 从您的测试文件中为您生成测试,但不会运行它们。您也许可以指示测试运行者按照您要求的顺序运行场景。
但是,我的建议是您不要尝试订购测试。每个场景应该完全独立于其他场景,以便测试运行的顺序不会影响结果。我想这取决于你所说的“好”是什么意思,如果它们以特定的顺序运行的话。 :)
I think that's more of a question for your test runner of choice. SpecFlow generates the tests for you from your test file, but it does not run them. You might be able to direct your test runner to run the scenarios in the order you ask.
However, my advice is that you do not attempt to order your tests. Each scenario should be be completely independent from others, so that the order the tests are run has no impact on the results. I guess it depends on what you mean by it being "nice" if they are run in a specific order. :)
我正在使用 resharper 插件来运行测试。因此,这里是按顺序排列它们的方法(我知道这不是最好的主意,但我有一个特殊情况。:))
Resharper 按给定功能文件的字母顺序对测试进行排序。
因此,我根据我希望它们运行的顺序使用前缀 1、2、3 等命名场景。
肮脏,但如果你绝望的话,这是一个不错的方法;)
I'm using resharper pluggin to run the tests. So here is what is did to make them in a order ( I know it is not the best idea, but I have a special case. :) )
Resharper orders the tests in the alphabetical order for a given feature file.
So I named the scenarios with prefixes 1,2,3 and so on based on the order i want them to run.
Dirty, but ok method if you are desperate ;)