wdio-cucumber-framework-在单个测试执行期间保持相同的webdriver会话 [英] wdio-cucumber-framework - Keep same webdriver session during single test execution
问题描述
我正在将wdio-cucumber-framework用于我的测试自动化.我在多个.feature文件中有测试用例.当我执行测试用例时,将为每个功能文件生成一个新的webdriver浏览器实例.
I am using wdio-cucumber-framework for my test automation. I have test cases in multiple .feature files. When I execute test cases a new webdriver browser instance is generated for each feature file.
设置
capabilities: [{
maxInstances: 1,
browserName: 'chrome'
}],
services: ['selenium-standalone'],
framework: 'cucumber',
reporters: ['spec'],
- 功能文件1 ---> 5个测试用例
- 功能文件2 ---> 2个测试用例
当我在两个功能文件中都执行所有测试用例时,将启动功能文件1的浏览器实例.一旦执行了功能文件1中的所有5个测试用例,浏览器实例便关闭了,我看到了wd/hub/session被删除了.
When I execute all the test cases in both feature files, a browser instance is launched for feature file 1. Once all the 5 test cases in feature file 1 are executed, browser instance got closed and I see wd/hub/session got deleted.
14:51:22] COMMAND DELETE "/wd/hub/session/a4e7a5e9-3a4a-4129-9a31-c7a1b458aeee"
------------------------------------------------------------------
[chrome #0-1] Session ID: a4e7a5e9-3a4a-4129-9a31-c7a1b458aeee
然后为功能文件2启动了一个新的浏览器实例.
Then a new browser instance got launched for Feature file 2. New webdriver instance got generated.
COMMAND POST "/wd/hub/session"
我希望所有功能文件都在单个webdriver实例/会话中执行.请让我知道是否有办法实现这一目标?
I want all the feature files to be executed in a single webdriver instance / Session. Please let me know if there is a way to achieve this ?
推荐答案
可能不是,因为功能文件是在不同的工作程序中启动的.
Probably not, because feature files are launched in different workers.
这篇关于wdio-cucumber-framework-在单个测试执行期间保持相同的webdriver会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!