Skip to content

Commit f8fc5f5

Browse files
Merge pull request #253265 from johnsta/patch-1
Suggested updates to concept-determine-optional-configuration.md
2 parents 38125d5 + 48a552d commit f8fc5f5

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

articles/playwright-testing/concept-determine-optimal-configuration.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ ms.custom: playwright-testing-preview
88

99
# Determine the optimal test suite configuration
1010

11-
Microsoft Playwright Testing Preview enables you to speed up your Playwright test execution by increasing parallelism at cloud scale. Several factors affect the completion time for your test suite. Determining the optimal configuration for reducing test suite completion is application-specific and requires experimentation. This article explains the different levels to configure parallelism for your tests, the factors that influence test duration, and how to determine your optimal configuration to minimize test completion time.
11+
Microsoft Playwright Testing Preview enables you to speed up your Playwright test execution by increasing parallelism at cloud scale. Several factors affect the completion time for your test suite. Determining the optimal configuration for reducing test suite completion time is application-specific and requires experimentation. This article explains the different levels to configure parallelism for your tests, the factors that influence test duration, and how to determine your optimal configuration to minimize test completion time.
1212

13-
In Playwright, you can run tests in parallel by using worker processes. By using Microsoft Playwright Testing, you can further increase parallelism by using cloud-hosted browsers. In general, adding more parallelism reduced the time to complete your test suite. However, adding more worker processes doesn't always result in shorter test suite completion times. For example, the client machine computing resources, network latency, or test complexity might also affect test duration.
13+
In Playwright, you can run tests in parallel by using worker processes. By using Microsoft Playwright Testing, you can further increase parallelism by using cloud-hosted browsers. In general, adding more parallelism reduces the time to complete your test suite. However, adding more worker processes doesn't always result in shorter test suite completion times. For example, the client machine computing resources, network latency, or test complexity might also affect test duration.
1414

1515
The following chart gives an example of running a test suite. By running the test suite with Microsoft Playwright Testing instead of locally, you can significantly increase the parallelism and reduce the test completion time. Notice that, when running with the service, the completion time reaches a minimum limit, after which adding more workers only has a minimal effect. The chart also shows how using more computing resources on the client machine positively affects the test completion time for tests running with the service.
1616

@@ -26,22 +26,22 @@ As previously shown in the chart, the test suite completion time doesn't continu
2626

2727
### Run tests locally
2828

29-
By default, Playwright limits the number of workers to 1/2 of the number of CPU cores on your machine. You can override the number of workers for running your test.
29+
By default, `@playwright/test` limits the number of workers to 1/2 of the number of CPU cores on your machine. You can override the number of workers for running your test.
3030

31-
When you run tests locally, the number of worker processes is limited to the number of CPU cores on your machine. In addition, beyond a certain point, adding more workers leads to resource contention, which slows down each worker and introduces test flakiness.
31+
When you run tests locally, the number of worker processes is limited to the number of CPU cores on your machine. Beyond a certain point, adding more workers leads to resource contention, which slows down each worker and introduces test flakiness.
3232

3333
To override the number of workers using the [`--workers` command line flag](https://playwright.dev/docs/test-cli#reference):
3434

3535
```bash
36-
npx playwright test --workers=30
36+
npx playwright test --workers=10
3737
```
3838

3939
To specify the number of workers in `playwright.config.ts` using the `workers` setting:
4040

4141
```typescript
4242
export default defineConfig({
4343
...
44-
workers: 5;
44+
workers: 10,
4545
...
4646
});
4747
```
@@ -55,15 +55,15 @@ Because the worker processes still run on the client machine (developer workstat
5555
You can specify the number of workers on the command line with the `--workers` flag:
5656

5757
```bash
58-
npx playwright test --config=playwright.service.config.ts --workers=20
58+
npx playwright test --config=playwright.service.config.ts --workers=30
5959
```
6060

6161
Alternately you can specify the number of workers in `playwright.service.config.ts` using the `workers` setting:
6262

6363
```typescript
6464
export default defineConfig({
6565
...
66-
workers: 5;
66+
workers: 30,
6767
...
6868
});
6969
```
@@ -96,7 +96,7 @@ Depending on the scenario, your requirements for test completion might be differ
9696

9797
### 2. Verify that your tests run correctly on the client machine
9898

99-
Before you run your Playwright test suite with Microsoft Playwright Testing, make sure that your tests run correctly on your client machine. If you run your tests as part of a CI workflow, validate that your tests run correctly on the CI agent machine.
99+
Before you run your Playwright test suite with Microsoft Playwright Testing, make sure that your tests run correctly on your client machine. If you run your tests as part of a CI workflow, validate that your tests run correctly on the CI agent machine. Ensure that you run your tests with a minimum of two parallel workers to verify that your tests are properly configured for parallel execution. Learn more about [parallelism in Playwright](https://playwright.dev/docs/test-parallel).
100100

101101
### 3. Run with cloud-hosted browsers on Microsoft Playwright Testing
102102

@@ -117,17 +117,19 @@ Experiment with the number of parallel workers to run your tests. Measure the te
117117
Notice at which point the test completion time no longer reduces as you add more workers. Move to the next step to further optimize your setup.
118118

119119
> [!NOTE]
120-
> While the service is in preview, the number of [parallel workers per workspace is limited](./resource-limits-quotas-capacity.md) to 50. You can request an increase of this limit for your workspace.
120+
> While the service is in preview, the number of [parallel workers per workspace is limited](./resource-limits-quotas-capacity.md) to 50. You can [request an increase of this limit for your workspace](https://aka.ms/mpt/feedback).
121121
122-
### 6. Increase computing resources on the client machine
122+
### 6. Scale the client
123123

124124
As you increase parallelism, the client machine might experience compute resource contention. Increase the computing resources on the client machine, for example by selecting [larger GitHub-hosted runners](https://docs.github.com/actions/using-github-hosted-runners/about-larger-runners).
125125

126+
Alternatively, if you have hardware limitations, you can [shard](https://playwright.dev/docs/test-sharding) your client tests.
127+
126128
Rerun your tests and experiment with the number of parallel workers.
127129

128130
### 7. Update your Playwright test configuration settings
129131

130-
Configure your Playwright test configuration settings, such as test [timeouts](https://playwright.dev/docs/test-timeouts), [trace](https://playwright.dev/docs/api/class-testoptions#test-options-trace) settings, or [reties](https://playwright.dev/docs/test-retries).
132+
Configure your Playwright test configuration settings, such as test [timeouts](https://playwright.dev/docs/test-timeouts), [trace](https://playwright.dev/docs/api/class-testoptions#test-options-trace) settings, or [retries](https://playwright.dev/docs/test-retries).
131133

132134
## Related content
133135

0 commit comments

Comments
 (0)