Skip to content

Commit eb10a7a

Browse files
committed
updated service config for NUnit
1 parent 72ac24b commit eb10a7a

File tree

2 files changed

+136
-1
lines changed

2 files changed

+136
-1
lines changed

articles/playwright-testing/how-to-use-service-config-file.md

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,35 @@ description: Learn how to use options available in configuration file with Micro
44
ms.topic: how-to
55
ms.date: 09/07/2024
66
ms.custom: playwright-testing-preview
7+
zone_pivot_group_filename: playwright-testing/ZonePivotGroups.json
8+
zone_pivot_groups: microsoft-playwright-testing
79
---
10+
::: zone pivot="playwright-test-runner"
811
# Use options available in configuration file with Microsoft Playwright Testing preview
912

1013
This article shows you how to use the options available in the `playwright.service.config.ts` file that was generated for you.
1114
If you don't have this file in your code, follow the QuickStart guide, see [Quickstart: Run end-to-end tests at scale with Microsoft Playwright Testing Preview](./quickstart-run-end-to-end-tests.md)
1215

16+
::: zone-end
17+
18+
::: zone pivot="nunit-test-runner"
19+
20+
# Use options available in configuration file with Microsoft Playwright Testing preview
21+
22+
This article shows you how to use the options available in the `.runsettings` file.
23+
If you don't have this file in your code, follow the QuickStart guide, see [Quickstart: Run end-to-end tests at scale with Microsoft Playwright Testing Preview](./quickstart-run-end-to-end-tests.md)
24+
25+
::: zone-end
26+
1327
> [!IMPORTANT]
1428
> Microsoft Playwright Testing is currently in preview. For legal terms that apply to Azure features that are in beta, in preview, or otherwise not yet released into general availability, see the [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/).
1529
1630
## Prerequisites
1731

1832
* Follow the Quickstart guide and set up a project to run with Microsoft Playwright Testing service. See, [Quickstart: Run end-to-end tests at scale with Microsoft Playwright Testing Preview](./quickstart-run-end-to-end-tests.md)
1933

34+
::: zone pivot="playwright-test-runner"
35+
2036
Here's version of the `playwright.service.config.ts` file with all the available options:
2137

2238
```typescript
@@ -136,4 +152,123 @@ export default defineConfig(
136152
],
137153
]
138154
```
155+
::: zone-end
156+
157+
::: zone pivot="nunit-test-runner"
158+
159+
160+
Here's version of the `.runsettings` file with all the available options:
161+
162+
```xml
163+
<?xml version="1.0" encoding="utf-8"?>
164+
<RunSettings>
165+
<TestRunParameters>
166+
<!-- Use this option when you want to authenticate using access tokens. This mode of auth should be enabled for the workspace. -->
167+
<Parameter name="ServiceAuthType" value="EntraId" />
168+
<!-- Select the operating system where you want to run tests. -->
169+
<Parameter name="Os" value="linux" />
170+
<!-- Set a unique ID for every test run to distinguish them in the service portal.-->
171+
<Parameter name="RunId" value="sample-run-id1" />
172+
<!--Select if you want to use cloud-hosted browsers to run your Playwright tests.-->
173+
<Parameter name="UseCloudHostedBrowsers" value="true" />
174+
<!--Select the authentication method you want to use with Entra-->
175+
<Parameter name="AzureTokenCredentialType" value="DefaultAzureCredential" />
176+
<!--Enable/disable GitHub summary in GitHub Actions workflow.-->
177+
<Parameter name="EnableGitHubSummary" value="false" />
178+
</TestRunParameters>
179+
<!-- NUnit adapter -->
180+
<NUnit>
181+
<!-- Adjust parallel workers, parallel worker would also be bound by number of unit test files -->
182+
<NumberOfTestWorkers>10</NumberOfTestWorkers>
183+
</NUnit>
184+
<!-- General run configuration -->
185+
<RunConfiguration>
186+
<EnvironmentVariables>
187+
<!-- For debugging selectors, it's recommend to set the following environment variable -->
188+
<DEBUG>pw:api</DEBUG>
189+
</EnvironmentVariables>
190+
</RunConfiguration>
191+
<!-- Playwright -->
192+
<Playwright>
193+
<BrowserName>chromium</BrowserName>
194+
<!--Set the timeout for your tests.-->
195+
<ExpectTimeout>5000</ExpectTimeout>
196+
<LaunchOptions>
197+
<Headless>false</Headless>
198+
<!--Channel>msedge</Channel-->
199+
</LaunchOptions>
200+
</Playwright>
201+
<LoggerRunSettings>
202+
<Loggers>
203+
<!--microsoft playwright testing service logger for reporting -->
204+
<Logger friendlyName="microsoft-playwright-testing" enabled="True" />
205+
<!--could enable any logger additionally -->
206+
<Logger friendlyName="trx" enabled="false" />
207+
</Loggers>
208+
</LoggerRunSettings>
209+
</RunSettings>
210+
211+
```
212+
213+
## Options in `.runsettings` file
214+
215+
* **`serviceAuthType`**:
216+
- **Description**: This setting allows you to choose the authentication method you want to use for your test run.
217+
- **Available Options**:
218+
- `ACCESS_TOKEN` to use access tokens. You need to enable authentication using access tokens if you want to use this option, see [manage authentication](./how-to-manage-authentication.md).
219+
- `ENTRA_ID` to use Microsoft Entra ID for authentication. It's the default mode.
220+
- **Default Value**: `ENTRA_ID`
221+
- **Example**:
222+
```xml
223+
<Parameter name="ServiceAuthType" value="EntraId" />
224+
```
225+
226+
227+
* **`os`**:
228+
- **Description**: This setting allows you to choose the operating system where the browsers running Playwright tests are hosted.
229+
- **Available Options**:
230+
- "windows" for Windows OS.
231+
- "linux" for Linux OS.
232+
- **Default Value**: "linux"
233+
- **Example**:
234+
```xml
235+
<Parameter name="Os" value="linux" />
236+
```
237+
238+
* **`runId`**:
239+
- **Description**: This setting allows you to set a unique ID for every test run to distinguish them in the service portal.
240+
- **Example**:
241+
```xml
242+
<Parameter name="RunId" value="sample-run-id1" />
243+
```
139244

245+
* **`AzureTokenCredentialType`**:
246+
- **Description**: This setting allows you to select the authentication method you want to use with Microsoft Entra ID.
247+
- **Example**:
248+
```xml
249+
<Parameter name="AzureTokenCredentialType" value="DefaultAzureCredential" />
250+
```
251+
252+
* **`useCloudHostedBrowsers`**
253+
- **Description**: This setting allows you to choose whether to use cloud-hosted browsers or the browsers on your client machine to run your Playwright tests. If you disable this option, your tests run on the browsers of your client machine instead of cloud-hosted browsers, and you don't incur any charges.
254+
- **Default Value**: true
255+
- **Example**:
256+
```xml
257+
<Parameter name="UseCloudHostedBrowsers" value="true" />
258+
```
259+
260+
* **`reporter`**
261+
- **Description**: You can publish your test results and artifacts to the service using `microsoft-playwright-testing` logger. You can disable reporting by removing this from your `.runsettings`
262+
- **Default Value**: true
263+
- **Example**:
264+
```xml
265+
<Logger friendlyName="microsoft-playwright-testing" enabled="True" />
266+
```
267+
* **`enableGitHubSummary`**:
268+
- **Description**: This setting allows you to configure the Microsoft Playwright Testing service reporter. You can choose whether to include the test run summary in the GitHub summary when running in GitHub Actions.
269+
- **Default Value**: true
270+
- **Example**:
271+
```xml
272+
<Parameter name="EnableGitHubSummary" value="false" />
273+
```
274+
::: zone-end

articles/playwright-testing/quickstart-run-end-to-end-tests.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ Run Playwright tests against browsers managed by the service and see the results
309309
```bash
310310
dotnet test --logger "microsoft-playwright-testing"
311311
```
312-
After the test run completes, you can view the test status in the terminal..
312+
After the test run completes, you can view the test status in the terminal.
313313
314314
```output
315315
Starting test execution, please wait...

0 commit comments

Comments
 (0)