如何并行运行 NUnit(Selenium Grid) 测试?

发布于 2024-07-06 16:41:47 字数 1449 浏览 8 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

等风来 2024-07-13 16:41:47

关于这个主题还没有很多工作。 我没有找到任何真正相关的东西。

然而,你的观点得到了很好的理解。 与强大的单核 CPU 相比,现在大多数机器都拥有更多的核心和更弱的核心。

所以我确实在微软博客上找到了一些东西。 该技术称为 PUnit,专门用于测试多线程环境。

它尽可能接近您所要求的内容:)

您可以在那里访问相应的博客文章:http://blogs.microsoft.co.il/blogs/eyal/archive/2008/07/09/punit -parallel-unit-testing-in-making.aspx

更新:链接不再有效。 CodePlex 上的项目已被删除。

更新 2:这是 NUnit 2.5 的路线图。 参考

There hasn't been a lot of work on this subject. I didn't find anything really relevent.

However, your point is well taken. Most machines nowadays have more cores and less powerful cores compared to powerful one core cpu.

So I did find something on a Microsoft blog. The technology is called PUnit and is made especially for testing multi-threaded environment.

It's as close as possible to what you requested that I could find :)

You can visit it the appropriate blog post right there: http://blogs.microsoft.co.il/blogs/eyal/archive/2008/07/09/punit-parallel-unit-testing-in-making.aspx

Update: Link is not valid anymore. The project on CodePlex has been removed.

Update2: This is on the roadmap for NUnit 2.5. Reference

淡淡绿茶香 2024-07-13 16:41:47

我自己也曾为这两个问题而苦苦挣扎。 最后,我开发了一个自定义的 Nunit 测试运行器,它能够并行运行多个测试。 这与 nunit 的 Taumuon.Rakija 扩展相结合,允许根据您希望测试运行的浏览器动态创建测试。

我现在可以在任意数量的操作系统上针对任意数量的浏览器类型并行启动我的测试套件。

不幸的是,这些问题似乎还没有一个好的解决方案,因此您可能必须针对您的特定环境自行解决它们。

I struggled with both these problems myself. In the end I developed a custom Nunit test runner that is capable of running multiple tests in parrallel. This combined with the Taumuon.Rakija extension for nunit allowed the tests to be dynmaically created depending on which browser you want the test to run on.

I'm now in a position where I can launch my test suite against as many browser types on as many operating systems as I wish in parrallel.

Unfortunately there doesn't seem to be a good solution to these problems already so you'll probably have to solve them yourself for your particular environment.

白首有我共你 2024-07-13 16:41:47

NUnit 版本 3 将支持并行运行测试,这与 Selenium Grid 配合使用效果很好:

将属性添加到类:[Parallelizes(ParallelScope.Self)] 将与其他测试类并行运行测试。

• ParallelScope.None 表示测试不能并行运行
与其他测试。

• ParallelScope.Self 表示测试
它本身可以与其他测试并行运行。

• ParallelScope.Children 表示测试的后代可以
彼此并行运行。

• ParallelScope.Fixtures 表示装置可以并行运行
彼此之间。

NUnit 框架并行测试执行

NUnit version 3 will support running tests in parallel, this works good with a Selenium Grid:

Adding the attribute to a class: [Parallelizable(ParallelScope.Self)] will run your tests in parallel with other test classes.

• ParallelScope.None indicates that the test may not be run in parallel
with other tests.

• ParallelScope.Self indicates that the test
itself may be run in parallel with other tests.

• ParallelScope.Children indicates that the descendants of the test may
be run in parallel with respect to one another.

• ParallelScope.Fixtures indicates that fixtures may be run in parallel
with one another.

NUnit Framework-Parallel-Test-Execution

不羁少年 2024-07-13 16:41:47

Igor Brejc 有一篇关于使用 MbUnit 并行运行测试的博客文章。

然而他确实说“一旦我们将 Selenium 集成到验收测试中”,所以看起来他只是在试验,我找不到任何其他帖子,所以我不知道他是否已成功并行运行 Selenium 测试。

http://igorbrejc.net/development/continuous-integration/ gallio-并行运行测试

Igor Brejc has a blog post about running tests in parallel using MbUnit.

However he does say "Once we integrate Selenium into acceptance testing", so it looks like he was just experimenting, I can't find any other posts so I don't know if he has successfully run Selenium tests in parallel.

http://igorbrejc.net/development/continuous-integration/gallio-running-tests-in-parallel

何以畏孤独 2024-07-13 16:41:47

您可以使用任务并行库和DynamicObject类来实现同一测试在多个浏览器上的并行化。 请参阅我的文章 并行运行 Selenium任何 .NET 单元测试工具 了解详细信息。

You can use the Task Parallel Library and the DynamicObject class to achieve parallelization of the same test on multiple browsers. See my article Running Selenium In Parallel with any .NET Unit Testing Tool for details.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文