Selenium Grid 中 IE6(和多个浏览器)的设置
我很难掌握有关 selenium Grid/RC 的一些概念。我需要的是为测试提供特定的环境(ie6-on-xp、ie7-on-xp 等)。对于我一直在阅读的内容,grid_configuration.yml
中的浏览器行没有提及我使用的 MSIE
或 Firefox
版本。我正在跑步。所以我不知道以哪种形式可以告诉 Grid/RC 我想要一些特定的浏览器以及运行它们的路径(RC 如何知道要运行哪个 exe?)
其次,我想运行便携式版本这些浏览器。我只在测试中看到了指定的内容,而没有在 RC 的命令行中看到运行它们的内容。每次测试就是这样做的吗?
I'm having a hard time trying to grasp some concepts on selenium Grid/RC. What I need is to provide specific environments (ie6-on-xp, ie7-on-xp, etc) to the tests. For what I've been reading, the browser line in grid_configuration.yml
do not make any reference of what version of MSIE
or Firefox
I'm running. So I can't get my head around in which form I can tell Grid/RC that I want some specific browsers and the path to run them (how RC knows which exe to run?)
Second, I'd like to run portable versions of those browsers. I've only seen that specified in the tests, and not in the RC's command line to run them. That is the way to do it, per test?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我将通过分解您需要的信息来回答您的问题
既然你不能在同一台机器上拥有多个 IE 实例,我知道有一些应用程序允许你这样做,但根据我的经验,它们造成的问题比解决问题更多。理想情况下,您希望不同的机器来运行测试。通过这样做,您还可以设置一个硒农场供您的开发人员使用,因为他们可以针对特定实例进行测试。因此,将网格设置为基础设施是一个很好的步骤。
YAML 只是让您知道网格可以处理什么。启动网格时,您需要确保传递类似的配置。像 Se:RC 一样思考 Se:GRID,只不过您不关心 RC 服务器在哪里,因为您与一个中心位置对话,该中心位置会为您解决其余问题。
如果您需要它针对特定项目运行测试,那么您将需要在测试设置中处理这个问题。有一个常见的误解,即所有测试在每个浏览器中运行都是相同的。如果您在测试中从不依赖 XPath 或 CSS 选择器,就会发生这种情况,因为浏览器处理此问题的方式总是略有不同,并且这些细微的差异可能会导致不稳定的测试,因此应始终避免。
指定使用哪个浏览器进行测试的一种方法是拥有一个中央配置文件。在 C# 中,这将使用具有每个浏览器集合的 app.config 并执行
Config
Central Config Class 查找 1 个元素
Tests
中的 内容python,您可以在包含在所有测试中的模块中创建一个数组
include.py
test.py
当使用 Selenium Grid 时,请尝试将其更多地视为测试基础设施帮助框架,希望对您有更多帮助。
我从未尝试过让 Selenium 在移动浏览器上工作,并且认为它不会很好地工作,但是对于目前处于 alpha 状态的 Selenium 2,Android 支持测试应用程序。
从评论中编辑
假设我们有上述设置,根据 YAML 文件,我们有许多不同的 *firefox 实例。因此,要在我们的测试中调用这些不同的命令,我们的浏览器设置命令将类似于
selenium.Start(hubHost, hubPort, "Firefox on Linux", "http://serverUnderTest");
或
selenium.Start(hubHost, hubPort, "Firefox on OS X", "http://serverUnderTest");
集线器会将其转换为 *firefox。我更喜欢为我的环境使用非常精细的名称,而不是通常的 *firefox,这样如果出现故障,可以更容易地发现它在哪里以及在哪个特定浏览器上。
I will answer your question by breaking up the info that you need
Well since you can't have multiple IE instances on the same machine, I know there are apps that allow you to do that but in my experience they cause more issues than solving them. Ideally you want different machines to run the tests. By doing this you are also setting up a selenium farm for your devs to use because they can target a test at a specific instance. So setting up Grid as an Infrastructure is a good step.
The YAML just lets you know what the grid can handle. When starting up the grid you need to make sure that you pass in similar configurations. Think of Se:GRID like you would Se:RC except you don't care where the RC server is because you speak to a central place that works the rest out for you.
If you need it to run tests against a specific items then you will need to handle this in your test setup. There is a common misconception that all tests will run the same in every single browser. This will happen if you never rely on XPath or CSS selectors in your tests because browsers always handle this slightly differently and the slight differences can lead to flaky tests which should always be avoided.
One way to specify which browser to use for a test is to have a central configuration file. In C# this would be using the app.config that has a collection for each browser and doing
Config
Central Config Class looking inside 1 element
Tests
In python you could create an Array in a module that you include on all your tests
include.py
test.py
When using Selenium Grid try thinking of it more as a test infrastructure help framework and hopefully that will help you a little more.
I have never tried to get Selenium to work on mobile browsers and don't think it would work to well, however with Selenium 2 which is currently in alpha there is android support for testing apps.
EDIT FROM COMMENT
So say we have the above setup, according to the YAML file we have a number of different *firefox instances. So to call those different ones in our tests our browser setup command would look like
selenium.Start(hubHost, hubPort, "Firefox on Linux", "http://serverUnderTest");
or
selenium.Start(hubHost, hubPort, "Firefox on OS X", "http://serverUnderTest");
The hub will translate that into *firefox for you. I prefer having very granular names for my environment instead of the usual *firefox so that if there is a failure its easier to spot where it was and on which specific browser.
虚拟机对于在 Selenium Grid farm 中设置“廉价”的 mule 来说非常方便。
Virtual machines can be very handy for setting up "inexpensive" mules in the Selenium Grid farm.