我有一种情况,我想并行运行一些量角器测试,以节省运行测试所需的时间。我遇到的困难是,其中一些测试无法并行运行,因为1个浏览器中的结果会影响另一个会话中的预期结果。
是否可以设置我的量角器配置文件以便能够执行此操作?我目前的设置如下所示,但这不起作用:
multiCapabilities:[
//tests run sequentially
{'browserName': 'firefox', specs: ['e2e/DynamicUpdates/**/*.spec.js'], maxInstances: 1, exclude: ['e2e/main/**/*.spec.js']},
{'browserName': 'chrome', specs: ['e2e/DynamicUpdates/**/*.spec.js'], maxInstances: 1, exclude: ['e2e/main/**/*.spec.js']},
{'browserName': 'internet explorer', specs: ['e2e/DynamicUpdates/**/*.spec.js'], maxInstances: 1, exclude: ['e2e/main/**/*.spec.js']},
{'browserName': 'safari', specs: ['e2e/DynamicUpdates/**/*.spec.js'], maxInstances: 1, exclude: ['e2e/main/**/*.spec.js']},
// Main tests - run in parallel
{'browserName': 'chrome', 'chromeOptions': {args: ['--start-maximized']}, shardTestFiles: true, maxInstances: 3},
{'browserName': 'firefox', shardTestFiles: true, maxInstances: 3},
{'browserName': 'safari', shardTestFiles: true, maxInstances: 3},
{
'browserName': 'internet explorer',
'binary': 'C:/Program Files (x86)/Internet Explorer/iexplore.exe',
'ensureCleanSession': true,
'nativeEvents': false,
'ignoreProtectedModeSettings': true,
'disable-popup-blocking': true,
'enablePersistentHover': true,
shardTestFiles: true,
maxInstances: 3
},
// Performance tests (currently not run against IE due to webdriver issues)
{'browserName': 'chrome', specs: ['/**/*.spec.js'] },
{'browserName': 'firefox', specs: ['/**/*.spec.js'] },
],
maxSessions:3,
答案 0 :(得分:1)
在specs数组中,按照您希望它们运行的顺序输出文件。或者保持原样并更改文件的名称,使它们以正确的顺序运行。
{'browserName': 'firefox',
specs: ['e2e/DynamicUpdates/folder1/testA.spec.js', 'e2e/DynamicUpdates/folder1/testB.spec.js', 'e2e/DynamicUpdates/folder1/testC.spec.js'],
maxInstances: 1, exclude: ['e2e/main/**/*.spec.js']},