[英]How can I run multiple tests in parallel with JS/nightwatchjs?
Can I execute multiple test cases in parallel through Nightwatch ?Is it Possible? 我可以通过Nightwatch并行执行多个测试用例吗?可能吗? I am searching for ability of threading capability in java for parallel test case execution.
我正在寻找java中的线程功能以进行并行测试用例执行。
Also what do you guys think about moving from Selenium to Nightwatch? 还有什么人想到从Selenium转移到Nightwatch?
You can see the thread for parallelism: nightwatchjs also take a look into parallel run 你可以看到并行线程: nightwatchjs也看看并行运行
Nightwatch is using the same selenium webdriver protocol but with some extra additions. Nightwatch使用相同的selenium webdriver协议,但有一些额外的补充。
Yes you can leverage the parallel mode of nightwatch js using following configuration: 是的,你可以使用以下配置来利用nightwatch js的并行模式:
test_workers: {
enabled: true,
workers: 'auto'
}
To execute tests in multiple browsers, you need to add the desired capabilities of the browsers and Test_worker configurations in nightwatch.json file. 要在多个浏览器执行测试,你需要添加nightwatch.json文件浏览器和Test_worker配置的需要的能力。
For eg. 例如。 if you want to use Opera you have to add this config:
如果你想使用Opera,你必须添加这个配置:
"cli_args": {
//path to Opera Webdriver File
"webdriver.opera.driver": "bin/operadriver"
}
"opera": {
"desiredCapabilities": {
"browserName": "opera"
}
}
For Test_Worker Configuration you should add: 对于Test_Worker配置,您应该添加:
"test_workers": {
"enabled": true,
"workers": "auto"
}
For example if you want to execute tests in three browsers parallely - Chrome, Firefox and Opera, your nightwatch.json should something like this. 例如,如果你想在三个浏览器中平行执行测试 - Chrome,Firefox和Opera,你的nightwatch.json应该是这样的。
{
"src_folders": [
"tests"
],
"output_folder": "reports",
"selenium": {
"start_process": true,
"server_path": "bin/selenium-server-standalone-3.12.0.jar",
"log_path": "",
"port": 4444,
"cli_args": {
"webdriver.chrome.driver": "bin/chromedriver",
"webdriver.gecko.driver": "bin/geckodriver",
"webdriver.opera.driver": "bin/operadriver"
}
},
"test_workers": {
"enabled": true,
"workers": "auto"
},
"test_settings": {
"default": {
"launch_url": "http://localhost",
"selenium_port": 4444,
"selenium_host": "localhost",
"silent": true,
"screenshots": {
"enabled": false,
"path": ""
},
"desiredCapabilities": {
"browserName": "chrome"
}
},
"firefox": {
"desiredCapabilities": {
"browserName": "firefox",
"marionette": true
}
},
"opera": {
"desiredCapabilities": {
"browserName": "opera"
}
}
}
}
For more info, you can look into this article: How To Execute Tests In Multiple Browsers Parallely With NIGHTWATCH JS . 有关详细信息,您可以查看以下文章: 如何在多个浏览器中执行测试并行使用NIGHTWATCH JS 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.