Skip to main content

WorkerInfo

WorkerInfo 包含有关正在运行测试的工作线程的信息,并且可用于工作线程范围内的夹具。WorkerInfoTestInfo 的子集,可在许多其他地方使用。

¥WorkerInfo contains information about the worker that is running tests and is available to worker-scoped fixtures. WorkerInfo is a subset of TestInfo that is available in many other places.


属性

¥Properties

config

Added in: v1.10 workerInfo.config

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

¥Processed configuration from the configuration file.

用法

¥Usage

workerInfo.config

类型

¥Type


parallelIndex

Added in: v1.10 workerInfo.parallelIndex

0workers - 1 之间的工作线程的索引。保证同时运行的 worker 有不同的 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 测试了解有关 并行性和分片 的更多信息。

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

用法

¥Usage

workerInfo.parallelIndex

类型

¥Type


project

Added in: v1.10 workerInfo.project

已处理 配置文件 中的项目配置。

¥Processed project configuration from the configuration file.

用法

¥Usage

workerInfo.project

类型

¥Type


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 测试了解有关 并行性和分片 的更多信息。

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

用法

¥Usage

workerInfo.workerIndex

类型

¥Type