我正在使用wdio
在我的本地计算机上运行测试;我启动一台服务器并对其进行测试。我将maxInstances
减少为1,这样在每次测试之前重置数据库都没有问题。
我的配置是:
exports.config = {
specs: [
'./test/wdioTests.js',
],
maxInstances: 1,
capabilities: [{
maxInstances: 1,
browserName: 'phantomjs',
}],
sync: true,
logLevel: 'command',
coloredLogs: true,
screenshotPath: './errorShots/',
baseUrl: process.env.ROOT_URL,
waitforTimeout: 10000,
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
services: [
'phantomjs'
],
framework: 'mocha',
reporters: ['spec'],
mochaOpts: {
ui: 'bdd',
compilers: ['js:babel-core/register'],
},
}
但是wdio
日志记录表明它在每个规范文件之前创建了一个新会话。
更糟糕的是,如果我使用--mochaOpts.grep
,它仍会经历为每个规范文件创建新会话的过程,即使该文件中的测试实际上没有运行,这也是不必要的时间。
如何让wdio
在开始时启动一个会话,而不是在为每个spec文件运行测试之前创建新会话?
我正在寻找一种更好的方法,而不仅仅是specs: ['./test/allTests.js']
并手动导入allTests.js
中的所有不同规范文件。