如何运行 webdriverio it-statements in a describe-block parallel, or a after other?
How to run webdriverio it-statements in a describe-block in parallel, or one after other?
我刚开始学习 WebdriverIO/JavaScript/WebUI 自动化。我有一个 describe()
函数,里面有多个 it()
语句。
我想 运行 那些 it()
语句,并行或按顺序依次进行。
const assert = require('assert')
const LoginPage = require('../pages/login.page')
describe('Test suite', () => {
it('Should display error when password is missing',() => {
// ...
})
it('Should display error when email is missing',() => {
// ...
})
it('Should display error when email and password are missing',() => {
// ...
})
it('Should display error when email is incorrect',() => {
// ...
})
it('Should display error when password is incorrect',() => {
// ...
})
it('Should display error when password case is incorrect',() => {
// ...
})
it('Should login with valid email and password',() => {
// ...
})
})
您不能 运行 您的 it-statements
并行。 WebdriverIO 只授予您并行 运行 不同文件的能力,这意味着您必须在综合 test-suites 中分离您的逻辑,这可以是 运行 通过多个 WDIO 进程。
为此,您必须在 wdio.conf.js
文件中设置 maxInstances: 2,
(或更多,取决于您的要求)。
示例: 让我们假设您有两个功能:登录 (LoginFlows.js
) & 注册(RegisterFlows.js
)。如果您有 maxInstances: 2,
,并且 运行 这两个功能,您将获得两个单独的 WDIO 会话 运行ning,每个测试套件一个 (两个浏览器会话将被分配).
您可以阅读更多相关信息 here。至于 运行 按顺序排列它们,这是默认行为。
因此,考虑到每个文件代表一个功能测试套件,您只能并行 运行 个不同的文件。希望现在事情变得更清楚了!
我刚开始学习 WebdriverIO/JavaScript/WebUI 自动化。我有一个 describe()
函数,里面有多个 it()
语句。
我想 运行 那些 it()
语句,并行或按顺序依次进行。
const assert = require('assert')
const LoginPage = require('../pages/login.page')
describe('Test suite', () => {
it('Should display error when password is missing',() => {
// ...
})
it('Should display error when email is missing',() => {
// ...
})
it('Should display error when email and password are missing',() => {
// ...
})
it('Should display error when email is incorrect',() => {
// ...
})
it('Should display error when password is incorrect',() => {
// ...
})
it('Should display error when password case is incorrect',() => {
// ...
})
it('Should login with valid email and password',() => {
// ...
})
})
您不能 运行 您的 it-statements
并行。 WebdriverIO 只授予您并行 运行 不同文件的能力,这意味着您必须在综合 test-suites 中分离您的逻辑,这可以是 运行 通过多个 WDIO 进程。
为此,您必须在 wdio.conf.js
文件中设置 maxInstances: 2,
(或更多,取决于您的要求)。
示例: 让我们假设您有两个功能:登录 (LoginFlows.js
) & 注册(RegisterFlows.js
)。如果您有 maxInstances: 2,
,并且 运行 这两个功能,您将获得两个单独的 WDIO 会话 运行ning,每个测试套件一个 (两个浏览器会话将被分配).
您可以阅读更多相关信息 here。至于 运行 按顺序排列它们,这是默认行为。
因此,考虑到每个文件代表一个功能测试套件,您只能并行 运行 个不同的文件。希望现在事情变得更清楚了!