我可以让 NUnit 按随机顺序执行测试吗?
问候, 我想让 NUnit 每次都以随机顺序执行我的单元测试,以确保它们是隔离的并且 首先。有谁知道在不分支 NUnit 的情况下完成此任务的简单方法吗?
Greetings,
I would like to make NUnit execute my unit tests in a random order every time in order to ensure they are isolated and FIRST. Does anyone know of a easy way to do this well without branching NUnit?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
似乎有一个 nUnit 插件: http://www.nablasoft.com/alkampfer/index.php/2008/12/06/randomizer-nunit-addin/
There looks to be an nUnit add-in for this: http://www.nablasoft.com/alkampfer/index.php/2008/12/06/randomizer-nunit-addin/
也许尝试使用 ReSharper 运行测试?我相信它会以不确定的顺序并行运行测试,但我对此并不能 100% 确定。
Maybe try running your tests with ReSharper? I believe it runs tests in parallel, and in a non-deterministic order, but I'm not 100% sure on that.
我的建议是使用 IronPython 进行测试。将测试编写为 IronPython 脚本,然后随机调用测试函数。 IronPython 的另一个优点是您可以快速调试不工作的东西;创建一些对象,将它们粘在一起,并确保它们的行为符合您的预期。一旦你掌握了它的窍门,它真的很强大。
My advice is to use IronPython for testing. Write your tests as IronPython scripts, and then randomly call the test function. The other advantage of IronPython is that you can quickly debug things that aren't working; create a few objects, stick 'em together, and make sure they behave as you intend them to. It's really powerful once you get the hang of it.