Skip to main content

WorkerInfo

WorkerInfo 包含关于正在运行测试的工作进程的信息,并且可用于工作进程作用域的夹具。WorkerInfoTestInfo 的一个子集,可在许多其他地方使用。


属性

🌐 Properties

config

Added in: v1.10 workerInfo.config

已处理来自配置文件的配置。

🌐 Processed configuration from the configuration file.

用法

workerInfo.config

类型


parallelIndex

Added in: v1.10 workerInfo.parallelIndex

位于 0workers - 1 之间的工作者索引。保证同时运行的工作者具有不同的 parallelIndex。当工作者重启时,例如在发生故障之后,新的工作者进程具有相同的 parallelIndex

🌐 The index of the worker between 0 and workers - 1. It is guaranteed that workers running at the same time have a different parallelIndex. When a worker is restarted, for example after a failure, the new worker process has the same parallelIndex.

也可以作为 process.env.TEST_PARALLEL_INDEX 使用。了解有关 Playwright Test 的 并行性和分片 的更多信息。

🌐 Also available as process.env.TEST_PARALLEL_INDEX. Learn more about parallelism and sharding with Playwright Test.

用法

workerInfo.parallelIndex

类型


project

Added in: v1.10 workerInfo.project

已处理来自配置文件的项目配置。

🌐 Processed project configuration from the configuration file.

用法

workerInfo.project

类型


workerIndex

Added in: v1.10 workerInfo.workerIndex

正在运行测试的工作进程的唯一索引。例如,当工作进程在失败后重启时,新的工作进程将获得一个新的唯一 workerIndex

🌐 The unique index of the worker process that is running the test. When a worker is restarted, for example after a failure, the new worker process gets a new unique workerIndex.

也可以作为 process.env.TEST_WORKER_INDEX 使用。了解有关 Playwright Test 的 并行性和分片 的更多信息。

🌐 Also available as process.env.TEST_WORKER_INDEX. Learn more about parallelism and sharding with Playwright Test.

用法

workerInfo.workerIndex

类型