我不清楚使用以下方法运行量角器测试有什么区别?
directConnect: true/false,
seleniumAddress: 'http://localhost:4444/wd/hub',
而且,为什么这样做有效?我用于运行测试的内容是什么?
我尚未在配置文件中声明上述任何选项,并且我正在运行所有测试。
这是我运行测试时的输出:
[16:26:42] I/launcher - Running 1 instances of WebDriver
[16:26:42] I/local - Starting selenium standalone server...
[16:26:46] I/local - Selenium standalone server started at http://193.167.1.94:57674/wd/hub
我/本地意味着我正在本地运行? directConnect是默认选项吗?
我看到我/托管在某个堆栈溢出帖子中。那意味着他们正在使用外部网格?
seleniumAddress
您可以将硒服务器或硒网格网址提供给seleniumAddress
。
您可以在测试的同一台或差异计算机上启动Selenium服务器或网格
脚本驻留
1.1)本地硒服务器
. Selenium server run on same machine where test scripts reside
. When running test, browser opened on the machine where selenium server running
. Communicate Path: ( in same machine where test script reside)
test script -> selenium server -> webdriver binary -> browser
1.2)远程硒服务器
. Selenium server run on remote machine where test scripts **NOT** reside
. When running test, browser opened on the remote machine where selenium server running
. Communicate Path: ( cross two machines )
test script -> test script machine
-> selenium server (on remote machine)
-> webdriver binary (on remote machine)
-> browser (on remote machine)
1.3)硒网格
. Grid use Master/Slave
. Multiple Slave machines register to One Master machine
. Each Slave can install couple kinds of browsers
. Slave tell Master it can provide the kinds of browser and
max browser instances running in parallel when register to Master
. Master will determine each test open browser on which Slave
by test required browser type and not exceed the max browser instances on slave
. Communicate Path: ( cross three machines )
test script -> test script machine
-> master machine
-> selenium server (on choosen slave machine)
-> webdriver binary (on choosen slave machine)
-> browser (on choosen slave machine)
directConnect
. When directConnect: true, seleniumAddress will be ignored (if both configured)
. Only chrome and firefox support directConnect so far
. Communicate Path: ( in same machine where test script reside)
test script -> webdriver binary -> browser
使用seleniumAddress,您可以在启动硒服务器/网格的终止窗口中看到测试脚本的日志与Webdriver进行通信。
从日志中,您可以获得以下信息:
这些信息对于调试测试脚本非常有用
默认情况下,量角器将不会在单独的终止窗口中启动webdriver二进制文件,也不会将通信日志定向到文件中。
因此它不适合调试测试脚本。
seleniumAddress
是硒服务器运行的位置。如果未指定,那么在执行框架时(通常在默认的硒端口4444上)将创建一个新的硒服务器实例。