我并不完全熟悉Visual Studio 2010(Ultimate)附带的测试套件,但我正在尝试使用Coded UI Tests 找到一种类似于Selenium Grid的方法.我希望能够将代理部署到Azure或EC2,执行所有编码的UI测试,然后将其拆除以进行冒烟测试,作为部署过程的一部分.
从我在网络上看到的情况来看,可以通过控制器和代理执行类似的操作,但我不确定其中有多少可以轻松迁移到云端.我发现了这些帖子:使用在Windows Azure上运行的代理进行负载测试:[ 1 2 3 ]但它们围绕负载测试.我的理解是负载测试可以编译并且易于部署,但对于Coded UI测试来说并不一定如此.
automated-tests selenium-grid smoke-testing visual-studio-2010 coded-ui-tests
目前使用默认配置运行的Selenium Grid2显示它可以运行5个firefox浏览器,5个chrome浏览器和1个IE浏览器.最多同时有5个实例.
如何更改此设置以便它同时运行10个chrome实例?
我已成功使用-maxSession 10更改了节点的maxsession参数.但是,当我运行10次测试时,集线器显示5个队列正在等待执行.
我不知道这是否重要,但是中心本身显示了一个5的maxSession参数.但是这个我无法改变.
关于如何做到这一点的任何想法?
我正在尝试录制我的Selenium-Tests的视频.这些测试在Selenium Grid上并行运行.我想为每个firefox打开一个VNC-Server,然后开始录制.因此,一个网格节点将打开5个vncservers,然后像'recordMyDesktop'这样的程序将记录它们中的每一个并将它们存储在不同的文件中.
我发现了这个:http://www.theautomatedtester.co.uk/blog/2010/castro-selenium-video.html 但不适用于Java和Grid ...
先感谢您
理查德(我的环境是Linux上的Firefox)
我正在尝试用selenium grid 2设置运行selenium测试.我的测试更依赖.我必须很好地定义我的顺序运行和并行运行.附加我的build.xml文件以供ref.在顺序节点内部,我有许多具有不同目标的并行节点.我在运行此build.xml时遇到了不一致的问题.
有时它会选择第二个并行节点的目标,有时则不会.它也没有给出错误.我尝试在详细模式下运行ant命令,仍然没有获得ant异常.
如果有人在这方面提供帮助,将会很高兴.
<target name="startServerRC" depends="startServerhub">
<echo>Starting Selenium Server...</echo>
<java jar="${lib.dir}/selenium-server-standalone.jar" fork="true" spawn="true">
<arg line="-port 5555"/>
<arg line="-log log.txt"/>
<arg line="-firefoxProfileTemplate"/>
<arg value="${lib.dir}/ff_profile"/>
<arg line="-userExtensions"/>
<arg value="${lib.dir}/user-extensions.js"/>
<arg line="-role node"/>
<arg line="-hub http://localhost:4444/grid/register "/>
<arg line="-maxSession 10"/>
<arg line="-maxInstances=10"/>
</java>
</target>
<!-- Initialization -->
<target name="init" depends="startServerRC" >
<echo>Initlizing...</echo>
<delete dir="${classes.dir}" />
<mkdir dir="${classes.dir}"/>
</target>
<!-- Complies the java files -->
<target name="compile" depends="init">
<echo>Compiling...</echo>
<javac
debug="true"
srcdir="${src.dir}"
destdir="${classes.dir}"
classpathref="classpath" />
</target>
<target name="CItarget">
<sequential>
<antcall target="compile"/>
<parallel> …Run Code Online (Sandbox Code Playgroud) 我一直有一个问题,我可以杀死产生节点的进程,但节点不会被杀死.有没有人有任何建议如何做到这一点?
我最近尝试完成的一些失败尝试是:
node.terminate()
Run Code Online (Sandbox Code Playgroud)
和
node.send_signal(signal.SIGINT)
Run Code Online (Sandbox Code Playgroud)
以下是代码:
from subprocess import Popen
import json
import sys
import os
import signal
import requests
FNULL = open(os.devnull, 'w')
json_data = open('nodes.json', 'r').read()
data = json.loads(json_data)
port = data['port']
# launch hub
hub = Popen('java -jar selenium-server-standalone-2.37.0.jar -role hub -port %s' % port, stdout=FNULL, stderr=FNULL, shell=True)
#launch nodes
nodes = []
for node in data['nodes']:
options = ''
if node['name'] == 'CHROME':
options += '-Dwebdriver.chrome.driver=../grid/chromedriver '
#options += ' -browser browserName='+node['name']+' maxInstances='+str(node['maxInstances'])
nodes.append(Popen('java -jar selenium-server-standalone-2.37.0.jar …Run Code Online (Sandbox Code Playgroud) 我从selnium独立服务器设置开始
java -jar selenium-server-standalone-2.32.0.jar
Run Code Online (Sandbox Code Playgroud)
这允许我成功连接并运行我的测试,一次运行多个浏览器.
当我使用以下设置作为集线器时有什么区别...
java -jar selenium-server-standalone-2.42.2.jar -role hub
Run Code Online (Sandbox Code Playgroud)
和一个附加的节点......
java -jar .\selenium-server-standalone-2.42.2.jar -role node -hub http://localhost:4444/grid/register
Run Code Online (Sandbox Code Playgroud)
这似乎也是一样的.
集线器/节点设置是否仅仅是配置灵活性的最佳选择?
首先,对不起我的英语,它不是那么完美:)
所以我面临以下问题:我正在尝试使用Selenium Grid和TestNg在不同的浏览器中运行并行测试,并且我在@BeforeTest方法中传递参数.我的问题是,当每个测试都被初始化时,似乎他们将使用最后一个测试的参数.因此,在此示例中,当我运行测试时,它将打开两个Chrome,而不是一个Firefox和一个Chrome. (browser.getDriver()方法返回一个RemoteWebDriver)
testng.xml文件:
<suite thread-count="2" verbose="10" name="testSuite" parallel="tests">
<test name="nameOfTheTestFirefox">
<parameter name="platform" value="windows"/>
<parameter name="browserVersion" value="32"/>
<parameter name="browserName" value="firefox"/>
<classes>
<class name="example.test.login.LoginOverlayTest"/>
</classes>
</test> <!-- nameOfTheTestFirefox -->
<test name="nameOfTheTestChrome">
<parameter name="platform" value="windows"/>
<parameter name="browserVersion" value="38"/>
<parameter name="browserName" value="chrome"/>
<classes>
<class name="example.test.login.LoginOverlayTest"/>
</classes>
</test> <!-- nameOfTheTestChrome -->
</suite> <!-- testSuite -->
Run Code Online (Sandbox Code Playgroud)
AbstractTest类:
public class SeleniumTest {
private static List<WebDriver> webDriverPool = Collections.synchronizedList(new ArrayList<WebDriver>());
private static ThreadLocal<WebDriver> driverThread;
public static BrowserSetup browser;
@Parameters({ "browserName", "browserVersion", "platform"})
@BeforeTest()
public static void …Run Code Online (Sandbox Code Playgroud) 我正在针对Selenium Grid运行并行自动化测试.
有时,测试失败;
Session [c1d99cc1-c689-4053-b68d-51c3682c13c4] was terminated due to CLIENT_STOPPED_SESSION (org.openqa.grid.common.exception.GridException)
[remote server] org.openqa.grid.internal.ActiveTestSessions(ActiveTestSessions.java):105:in `getExistingSession'
Run Code Online (Sandbox Code Playgroud)
Selenium文档说;
CLIENT_STOPPED_SESSION The session was stopped using an ordinary call to stop/quit on the client. Why are you using it again??
Run Code Online (Sandbox Code Playgroud)
但是,我知道客户端没有尝试停止/退出.我使用并行rspec,所以每个线程实际上是它自己的Ruby实例,所以没有问题测试方.
此外,如果我使用http:// {node_ip}:5556/wd/hub/static/resource/hub.html直接查询节点,我可以看到会话仍处于打开状态.如果已发出退出/停止,则此会话将被删除.
似乎只有Selenium Grid Hub中的会话注册表认为此会话已停止.没有证据表明会话在其他地方被停止.
Grid中是否存在已知问题,其中错误的会话已标记为已停止?
在我的selenium网格设置中,我的会话请求(正在等待空插槽变为可用)超时,newSessionWaitTimeout因为它们正在命中RemoteWebDriver命令超时.
我有时会尝试运行比我的节点上的可用插槽更多的测试.这被认为是细如尝试在可用插槽得到一个新的会话测试得到排队等候直至插槽是免费的.我可以在我的网格控制台中正确地看到这种情况(下面的示例消息).
3个请求等待插槽空闲.功能[{browserName = chrome,javascriptEnabled = true,version =,platform = ANY}]功能[{browserName = chrome,javascriptEnabled = true,version =,platform = ANY}]功能[{browserName = chrome,javascriptEnabled = true,version =,platform = ANY}]
但是,这些请求在webdriver的命令超时期限后超时,实际上忽略了该newSessionWaitTimeout设置.我newSessionWaitTimeout被设置为默认值-1,允许无限期等待一个插槽.webdriver命令超时默认为60秒.
OneTimeSetUp:OpenQA.Selenium.WebDriverException:远程WebDriver服务器对URL http:// {myHubIP}:4444/wd/hub/session的HTTP请求在60秒后超时.----> System.Net.WebException:操作已超时Exception没有stacktrace
我可以将驱动程序的超时增加到大于我的测试可能需要等待获取插槽的大量,但这将影响驱动程序执行的每个命令.基本上删除命令超时似乎是不合理的,以确保我的测试在等待打开的插槽时不会超时,特别是当有一个特定的设置应该处理等待会话的超时时.
所以,我觉得我在某种程度上错过了一些东西......
我测试过以确保我的newSessionWaitTimeout实际工作是通过在我看到的60秒超时下降值(将其降至10秒).在运行比打开的插槽更多的测试时执行此操作会在10秒后给出预期的错误,就在提示上.
System.InvalidOperationException:转发新会话时出错请求超时等待节点变为可用.在OpenQA上的OpenQA.Selenium.Remium.Selenium.Remium.RemoteWebDriver.Execute(String driverCommandToExecute,Dictionary`2参数)的OpenQA.Selenium.Remote.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)中的OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities). OpenQA.Selenium.Remote.RemoteWebDriver..ctor(Uri remoteAddress,ICapabilities desiredCapabilities)中的Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor,ICapabilities desiredCapabilities)
因此,newSessionWaitTimeout如果实际达到限制,我可以看到工作正常.
newSessionWaitTimeout使用低于0(无限期等待)或高于驱动程序命令超时(默认为60秒)的任何内容运行相同的测试从不会遇到上述错误,因为请求首先超时.而是给出我在上面的概述部分中列出的错误.
现在,如果我增加RemoteWebDriver的超时,我可以看到这是我在等待新会话时遇到的超时.例如,如果我初始化我的RemoteWebDriver
new RemoteWebDriver(new Uri($"http://{myHubIP}:4444/wd/hub"), capabilities, TimeSpan.FromMinutes(3));然后我得到错误:
OneTimeSetUp:OpenQA.Selenium.WebDriverException:对URL http:// {myHubIP}的远程WebDriver服务器的HTTP请求:4444/wd/hub/session在180秒后超时.----> System.Net.WebException:操作已超时Exception没有stacktrace
再说一遍,如果我把这个值提高到足够的水平(如果我要运行很多测试,可能需要非常大),它解决了我的等待会话问题,但现在所有的驱动程序命令都有可能被挂起很长时间.关于如何正确解决这个问题的想法(这似乎不正确)?
我正在使用Selenium WebDriver和服务器独立3.0.1
目前,我的框架代码是用 Java/Maven 编写的,我想使用 Selenium 网格和 Jenkins 运行此代码。我已将 Jenkins 配置为从 SVN 中提取最新代码,并已将 Jenkins 设置为集线器。
我想知道的是如何让 Jenkins 管理虚拟机?例如,如何让 Jenkins 使用 Windows 7 或 10 启动虚拟机,使用我需要测试的任何浏览器,以及如何让虚拟机将自己声明为节点?
我是手动配置虚拟机/节点并让它们保持活动状态,还是有办法使用 Jenkins 自动执行此过程?
continuous-integration selenium-grid jenkins jenkins-plugins
selenium-grid ×10
selenium ×4
java ×2
python ×2
ant ×1
c# ×1
jenkins ×1
subprocess ×1
testng ×1