运行多个守夜实例 [英] Running multiple nightwatch instances

查看:92
本文介绍了运行多个守夜实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我目前的公司中,我们大约有10个网站.所有这些网站都来自单个代码库.

At my current company, we have about 10 websites.. That all extend from a single codebase.

每当我们更改核心"代码库中的内容时,我们都希望在所有10个网站上并行运行测试.在云端,这要容易得多,但我们也希望能够在本地进行.

Whenever we change something in the 'core' codebase, we want to run tests on all 10 websites in parallel. Its a lot easier in the cloud, but we also want to be able to do it locally.

为此,我基本上启动了多个Selenium实例,每个实例都有其自己的端口,并为每个实例设置一个不同的Nightwatch launch_url

For this to happen, I basically start multiple Selenium instances, all with its own port, and set a different nightwatch launch_url for every instance

因此,我制作了一个NodeJS脚本.为每个站点创建一个nightwatch.json,每个站点都拥有自己的launch_url和selenium端口.并根据其自己的json配置文件生成了10次守夜.

So I made a NodeJS script.. That creates a nightwatch.json for every site, each holding its own launch_url and selenium port.. And spawns nightwatch 10 times referring to its own json config file.

但是我不知道这是否是正确"的方法.

But I wonder if thats the 'correct' approach.

Selenium Grid是否可以解决此问题?还用于本地测试吗?

Does Selenium Grid solve this problem? Also for local testing?

谢谢!

推荐答案

Selenium网格旨在能够处理多个并行会话.

Selenium grid is designed to be able to handle multiple parallel sessions.

您应该只有一个带有一个或多个硒节点的硒集线器. 使用额外的参数-browser

You should have just one selenium hub with one or more selenium nodes. Start your selenium node with extra params -browser

示例

java -jar selenium_server.jar -Dwebdriver.chrome.driver=$CHROMEDRIVER -role node -hub http://localhost:4444/grid/register -maxSession 20 -browser browserName=chrome,maxInstances=10 -browser browserName=firefox,maxInstances=10"

java -jar selenium_server.jar -Dwebdriver.chrome.driver=$CHROMEDRIVER -role node -hub http://localhost:4444/grid/register -maxSession 20 -browser browserName=chrome,maxInstances=10 -browser browserName=firefox,maxInstances=10"

(有关maxSession与maxInstances之间的差异,请检查以下一项: Selenium Grid:MaxSessions与MaxInstances )

(for difference between maxSession vs maxInstances check this one: Selenium Grid: MaxSessions vs MaxInstances)

可以将所有测试配置为使用相同的硒集线器实例.

All your tests could be configured to use the same selenium hub instance.

这篇关于运行多个守夜实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆