gpt4 book ai didi

javascript - BrowserStack - Node.js 并发测试

转载 作者:行者123 更新时间:2023-11-30 12:44:25 24 4
gpt4 key购买 nike

我一直在寻找方法,专门使用 BrowserStack 在 Node.js 中创建合理的可扩展测试结构。

请在此处查看源代码:

https://gist.github.com/Palgie/10886008

我在尝试关闭 session 或退出驱动程序时遇到问题,因此在运行并发测试时它会经常告诉我我的最大 session 正在使用中(见下文)。

这感觉像是一种竞争条件,但它可能非常明显。

  Now testing Chrome - 22.0
Now testing IE - 10.0
․․․․
Stopping test
Stopping test


4 passing (14s)
1 failing

1) "after all" hook:
Error: This driver instance does not have a valid session ID (did you call WebDriver.quit()?) and may no longer be used.
at checkHasNotQuit (/Users/gourleyp/Sites/bs-webdriver/node_modules/browserstack-webdriver/lib/webdriver/webdriver.js:291:13)
at webdriver.WebDriver.schedule (/Users/gourleyp/Sites/bs-webdriver/node_modules/browserstack-webdriver/lib/webdriver/webdriver.js:263:3)
at webdriver.WebDriver.quit (/Users/gourleyp/Sites/bs-webdriver/node_modules/browserstack-webdriver/lib/webdriver/webdriver.js:331:21)
at Context.<anonymous> (/Users/gourleyp/Sites/bs-webdriver/driver.js:35:14)
at webdriver.promise.ControlFlow.runInNewFrame_ (/Users/gourleyp/Sites/bs-webdriver/node_modules/browserstack-webdriver/lib/webdriver/promise.js:1598:20)
at webdriver.promise.ControlFlow.runEventLoop_ (/Users/gourleyp/Sites/bs-webdriver/node_modules/browserstack-webdriver/lib/webdriver/promise.js:1463:8)
at wrapper [as _onTimeout] (timers.js:252:14)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
==== async task ====
at Context.<anonymous> (/Users/gourleyp/Sites/bs-webdriver/node_modules/browserstack-webdriver/testing/index.js:126:14)
at Hook.Runnable.run (/usr/local/lib/node_modules/mocha/lib/runnable.js:196:15)
at next (/usr/local/lib/node_modules/mocha/lib/runner.js:259:10)
at /usr/local/lib/node_modules/mocha/lib/runner.js:271:7
at done (/usr/local/lib/node_modules/mocha/lib/runnable.js:185:5)
at /usr/local/lib/node_modules/mocha/lib/runnable.js:199:9
at /Users/gourleyp/Sites/bs-webdriver/node_modules/browserstack-webdriver/testing/index.js:92:5
at /Users/gourleyp/Sites/bs-webdriver/node_modules/browserstack-webdriver/lib/goog/base.js:1178:15
at webdriver.promise.ControlFlow.runInNewFrame_ (/Users/gourleyp/Sites/bs-webdriver/node_modules/browserstack-webdriver/lib/webdriver/promise.js:1598:20)
at notify (/Users/gourleyp/Sites/bs-webdriver/node_modules/browserstack-webdriver/lib/webdriver/promise.js:428:12)
at notifyAll (/Users/gourleyp/Sites/bs-webdriver/node_modules/browserstack-webdriver/lib/webdriver/promise.js:397:7)
at resolve (/Users/gourleyp/Sites/bs-webdriver/node_modules/browserstack-webdriver/lib/webdriver/promise.js:375:7)
at fulfill (/Users/gourleyp/Sites/bs-webdriver/node_modules/browserstack-webdriver/lib/webdriver/promise.js:493:5)
at /Users/gourleyp/Sites/bs-webdriver/node_modules/browserstack-webdriver/lib/webdriver/promise.js:1465:10
at Object.webdriver.promise.asap (/Users/gourleyp/Sites/bs-webdriver/node_modules/browserstack-webdriver/lib/webdriver/promise.js:732:5)
at newFrame.then.e (/Users/gourleyp/Sites/bs-webdriver/node_modules/browserstack-webdriver/lib/webdriver/promise.js:1614:25)
at /Users/gourleyp/Sites/bs-webdriver/node_modules/browserstack-webdriver/lib/goog/base.js:1178:15
at webdriver.promise.ControlFlow.runInNewFrame_ (/Users/gourleyp/Sites/bs-webdriver/node_modules/browserstack-webdriver/lib/webdriver/promise.js:1598:20)
at notify (/Users/gourleyp/Sites/bs-webdriver/node_modules/browserstack-webdriver/lib/webdriver/promise.js:428:12)
at notifyAll (/Users/gourleyp/Sites/bs-webdriver/node_modules/browserstack-webdriver/lib/webdriver/promise.js:397:7)
at resolve (/Users/gourleyp/Sites/bs-webdriver/node_modules/browserstack-webdriver/lib/webdriver/promise.js:375:7)
at fulfill (/Users/gourleyp/Sites/bs-webdriver/node_modules/browserstack-webdriver/lib/webdriver/promise.js:493:5)
at webdriver.promise.ControlFlow.resolveFrame_ (/Users/gourleyp/Sites/bs-webdriver/node_modules/browserstack-webdriver/lib/webdriver/promise.js:1519:9)
at webdriver.promise.ControlFlow.getNextTask_ (/Users/gourleyp/Sites/bs-webdriver/node_modules/browserstack-webdriver/lib/webdriver/promise.js:1488:12)
at webdriver.promise.ControlFlow.runEventLoop_ (/Users/gourleyp/Sites/bs-webdriver/node_modules/browserstack-webdriver/lib/webdriver/promise.js:1446:59)
at wrapper [as _onTimeout] (timers.js:252:14)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

在我引用的源代码中,据我所知它应该执行 session ,但感觉不像它。

test.after(function() {
console.log('Stopping test');
driver.quit();
});

据我所知,在该浏览器中运行所有 mocha 测试或 webdriver 测试后,它将终止驱动程序,然后在 before 方法中初始化一个新实例。

如有任何帮助,我们将不胜感激!

干杯

最佳答案

您可以使用 selenium-runner 并行运行测试。以下文档中提供了使用 selenium-runner 在 BrowserStack 上并行运行测试的示例:https://www.browserstack.com/automate/node .

此外,如果 selenium-runner 不能满足您的需求,能否请您分享您的需求(您想并行运行哪个特定框架或库代码)以便我们研究问题

阿克谢@浏览器栈

关于javascript - BrowserStack - Node.js 并发测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23113175/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com