有没有人找到并行运行 C# Selenium RC 测试的方法?

发布于 2024-07-04 13:05:17 字数 520 浏览 10 评论 0原文

有人找到了一种方法来并行运行用 C# 编写的 Selenium RC / Selenium Grid 测试吗?

我目前有一个使用 Selenium RC 的 C# 驱动程序编写的相当大的测试套件。 运行整个测试套件需要一个多小时才能完成。 我通常不必运行整个套件,因此到目前为止这还不是一个问题,但我希望能够更定期地执行此操作(即,作为自动构建的一部分)

我'最近花了一些时间研究 Selenium Grid 项目,其目的本质上是允许这些测试并行运行。 不幸的是,我正在使用的 TestDriven.net 插件似乎串行运行测试(即一个接一个)。 我假设 NUnit 会以类似的方式执行测试,尽管我还没有实际测试过。

我注意到 NUnit 2.5 beta 开始谈论与 pNUnit 并行运行测试,但我还没有真正熟悉该项目,无法确定这是否可行。

我正在考虑的另一个选择是将我的测试套件分离到不同的库中,这将使我同时从每个库运行测试,但如果可能的话我想避免这种情况,因为我不相信这是拆分的有效原因测试套件。

Has anyone found a way to run Selenium RC / Selenium Grid tests, written in C# in parallel?

I've currently got a sizable test suite written using Selenium RC's C# driver. Running the entire test suite takes a little over an hour to complete. I normally don't have to run the entire suite so it hasn't been a concern up to now, but it's something that I'd like to be able to do more regularly (ie, as part of an automated build)

I've been spending some time recently poking around with the Selenium Grid project whose purpose essentially is to allow those tests to run in parallel. Unfortunately, it seems that the TestDriven.net plugin that I'm using runs the tests serially (ie, one after another). I'm assuming that NUnit would execute the tests in a similar fashion, although I haven't actually tested this out.

I've noticed that the NUnit 2.5 betas are starting to talk about running tests in parallel with pNUnit, but I haven't really familiarized myself enough with the project to know for sure whether this would work.

Another option I'm considering is separating my test suite into different libraries which would let me run a test from each library concurrently, but I'd like to avoid that if possible since I'm not convinced this is a valid reason for splitting up the test suite.

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

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

发布评论

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

评论(3

小兔几 2024-07-11 13:05:17

我正在研究这件事,并发现 Gallio 最新的可以并行驱动 mbUnit 测试。 您可以针对单个 Selenium Grid 集线器驱动它们,该集线器可以有多个远程控制服务器进行监听。

我正在使用 Gallio 的每晚来获取

我注意到的一件事是我不能依赖 TestSetTestTeardown 来隔离并行测试。 您需要测试看起来像这样:

[Test] public void Foo(){
  var s = new DefaultSelenium("http://grid", 4444, "*firefox",
                              "http://server-under-test");
  s.Start();
  s.Open("mypage.aspx");
  // Continue
  s.Stop();

}

使用 [SetUp] 属性启动 Selenium 会话导致测试无法从 s.Start()< 获取远程会话/代码>。

I am working on this very thing and have found Gallio latest can drive mbUnit tests in parallel. You can drive them against a single Selenium Grid hub, which can have several remote control servers listening.

I'm using the latest nightly from Gallio to get the ParallelizableAttribute and DegreeOfParallelismAttribute.

Something things I've noticed is I cannot rely on TestSet and TestTeardown be isolated the parallel tests. You'll need the test to look something like this:

[Test] public void Foo(){
  var s = new DefaultSelenium("http://grid", 4444, "*firefox",
                              "http://server-under-test");
  s.Start();
  s.Open("mypage.aspx");
  // Continue
  s.Stop();

}

Using the [SetUp] attribute to start the Selenium session was causing the tests to not get the remote session from s.Start().

遗失的美好 2024-07-11 13:05:17

大约三年前,我编写了 PNUnit 作为 NUnit 的扩展,我很高兴看到它最终集成到 NUnit 中。

我们每天都使用它在不同的发行版和组合下测试我们的软件。 举个例子:我们有一个包含大约 210 个测试的繁重测试(长测试)的测试套件。 他们每个人都设置一个服务器并在命令行中运行一个客户端,运行多个操作(最多 210 个场景)。

好吧,我们使用相同的套件在不同的 Linux 组合和 Windows 变体上运行测试,并且还组合了 Windows 服务器与 Linux 客户端、Windows XP、Vista,然后是域控制器、域外等等。 我们使用相同的二进制文件,然后在几个盒子上启动“代理”。

我们使用相同的平台进行:平衡负载测试负载-> 我的意思是,以块的形式运行得更快。 同时运行多个组合,我认为更有趣的是:定义多客户端场景:两个客户端等待服务器启动,然后启动操作,彼此同步等等。 我们还使用 PNUnit 进行负载测试(针对单个服务器的数百个盒子)。

因此,如果您对如何设置有任何疑问(恐怕这还不简单),请随时询问。

我很久以前也在 DDJ 上写过一篇关于它的文章: http://www.ddj.com/architect/ 193104810

希望有帮助

I wrote PNUnit as an extension for NUnit almost three years ago and I'm happy to see it was finally integrated into NUnit.

We use it on a daily basis to test our software under different distros and combinations. Just to give an example: we've a test suite of heavy tests (long ones) with about 210 tests. Each of them sets up a server and runs a client in command line running several operations (up to 210 scenarios).

Well, we use the same suite to run the tests on different Linux combinations and windows variations, and also combined ones like a windows server with a linux client, windows xp, vista, then domain controller, out of domain, and so on. We use the same binaries and then just have "agents" launched at several boxes.

We use the same platform for: balancing load test load -> I mean, running in chunks faster. Running several combinations at the same time, and what I think is more interesting: defining multi client scenarios: two clients wait for the server to start up, then launch operations, synch with each other and so on. We also use PNUnit for load testing (hundreds of boxes against a single server).

So, if you have any questions about how to set it up (which is not simple yet, I'm afraid), don't hesitate to ask.

Also I wrote an article long ago about it at DDJ: http://www.ddj.com/architect/193104810

Hope it helps

隔纱相望 2024-07-11 13:05:17

我不知道没有答案是否算作答案,但我想说您已经研究了所有内容,并且确实提出了 2 个可能的解决方案...

  • 测试套件并行运行测试
  • 将测试套件拆分

我不知所措对于任何其他事情。

I don't know if no answer counts as an answer but I'd say you have researched everything and you really came up with the 2 possible solutions...

  • Test Suite runs tests in parallel
  • Split the test suite up

I am at a loss for any thing else.

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