mirror of
https://github.com/microsoft/playwright.git
synced 2025-01-05 19:04:43 +03:00
docs(dotnet): TestRunParameters -> Playwright runsettings node (#16505)
This commit is contained in:
parent
2bdf51d284
commit
32adf50e65
@ -31,23 +31,13 @@ You can run a single test, a set of tests or all tests. Tests can be run on diff
|
||||
|
||||
- Running Tests on specific browsers
|
||||
|
||||
```bash tab=bash-bash
|
||||
BROWSER=webkit dotnet test
|
||||
```
|
||||
|
||||
```batch tab=bash-batch
|
||||
set BROWSER=webkit
|
||||
dotnet test
|
||||
```
|
||||
|
||||
```powershell tab=bash-powershell
|
||||
$env:BROWSER="webkit"
|
||||
dotnet test
|
||||
```bash
|
||||
dotnet test -- Playwright.BrowserName=webkit
|
||||
```
|
||||
|
||||
- Running Tests on multiple browsers
|
||||
|
||||
To run your test on multiple browsers or configurations you need to invoke the `dotnet test` command multiple times. There you can then either specify the `BROWSER` environment variable (like the previous) or pass the `browser` via the runsettings file:
|
||||
To run your test on multiple browsers or configurations you need to invoke the `dotnet test` command multiple times. There you can then either specify the `BROWSER` environment variable or set the `Playwright.BrowserName` via the runsettings file:
|
||||
|
||||
```bash
|
||||
dotnet test --settings:chromium.runsettings
|
||||
@ -58,10 +48,9 @@ You can run a single test, a set of tests or all tests. Tests can be run on diff
|
||||
```xml
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RunSettings>
|
||||
<TestRunParameters>
|
||||
<Parameter name="browser" value="chromium" />
|
||||
<Parameter name="headless" value="false" />
|
||||
</TestRunParameters>
|
||||
<Playwright>
|
||||
<BrowserName>chromium</BrowserName>
|
||||
</Playwright>
|
||||
</RunSettings>
|
||||
```
|
||||
|
||||
|
@ -154,24 +154,18 @@ CLI. See the following example:
|
||||
```xml
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RunSettings>
|
||||
<TestRunParameters>
|
||||
<Parameter name="browser" value="chromium" />
|
||||
<Parameter name="headless" value="false" />
|
||||
<Parameter name="channel" value="msedge" />
|
||||
</TestRunParameters>
|
||||
<Playwright>
|
||||
<BrowserName>chromium</BrowserName>
|
||||
<LaunchOptions>
|
||||
<Headless>false</Headless>
|
||||
<Channel>msedge</Channel>
|
||||
</LaunchOptions>
|
||||
</Playwright>
|
||||
</RunSettings>
|
||||
```
|
||||
|
||||
```bash tab=bash-bash
|
||||
dotnet test -- TestRunParameters.Parameter\(name=\"browser\", value=\"chromium\"\) TestRunParameters.Parameter\(name=\"headless\", value=\"false\"\) TestRunParameters.Parameter\(name=\"channel\", value=\"msedge\"\)
|
||||
```
|
||||
|
||||
```batch tab=bash-batch
|
||||
dotnet test -- TestRunParameters.Parameter(name=\"browser\", value=\"chromium\") TestRunParameters.Parameter(name=\"headless\", value=\"false\") TestRunParameters.Parameter(name=\"channel\", value=\"msedge\")
|
||||
```
|
||||
|
||||
```powershell tab=bash-powershell
|
||||
dotnet test -- TestRunParameters.Parameter(name=\"browser\", value=\"chromium\") TestRunParameters.Parameter(name=\"headless\", value=\"false\") TestRunParameters.Parameter(name=\"channel\", value=\"msedge\")
|
||||
```bash
|
||||
dotnet test -- Playwright.BrowserName=chromium Playwright.LaunchOptions.Headless=false Playwright.LaunchOptions.Channel=msedge
|
||||
```
|
||||
|
||||
### Using Verbose API Logs
|
||||
@ -180,29 +174,33 @@ When you have enabled the [verbose API log](./debug.md#verbose-api-logs), via th
|
||||
|
||||
### Using the .runsettings file
|
||||
|
||||
When running tests from Visual Studio, you can take advantage of the `.runsettings` file.
|
||||
When running tests from Visual Studio, you can take advantage of the `.runsettings` file. The following shows a reference of the supported values.
|
||||
|
||||
For example, to specify the amount of workers (`NUnit.NumberOfTestWorkers`), you can use the following snippet:
|
||||
For example, to specify the amount of workers you can use `NUnit.NumberOfTestWorkers` or to enable `DEBUG` logs `RunConfiguration.EnvironmentVariables`.
|
||||
|
||||
```xml
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RunSettings>
|
||||
<!-- NUnit adapter -->
|
||||
<NUnit>
|
||||
<NumberOfTestWorkers>24</NumberOfTestWorkers>
|
||||
</NUnit>
|
||||
</RunSettings>
|
||||
```
|
||||
|
||||
If you want to enable debugging, you can set the `DEBUG` variable to `pw:api` as documented, by doing:
|
||||
|
||||
```xml
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RunSettings>
|
||||
<!-- General run configuration -->
|
||||
<RunConfiguration>
|
||||
<EnvironmentVariables>
|
||||
<!-- For debugging selectors, it's recommend to set the following environment variable -->
|
||||
<DEBUG>pw:api</DEBUG>
|
||||
</EnvironmentVariables>
|
||||
</RunConfiguration>
|
||||
<!-- Playwright -->
|
||||
<Playwright>
|
||||
<BrowserName>chromium</BrowserName>
|
||||
<ExpectTimeout>5000</ExpectTimeout>
|
||||
<LaunchOptions>
|
||||
<Headless>true</Headless>
|
||||
<Channel>msedge</Channel>
|
||||
</LaunchOptions>
|
||||
</Playwright>
|
||||
</RunSettings>
|
||||
```
|
||||
|
||||
@ -363,24 +361,18 @@ CLI. See the following example:
|
||||
```xml
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RunSettings>
|
||||
<TestRunParameters>
|
||||
<Parameter name="browser" value="chromium" />
|
||||
<Parameter name="headless" value="false" />
|
||||
<Parameter name="channel" value="msedge" />
|
||||
</TestRunParameters>
|
||||
<Playwright>
|
||||
<BrowserName>chromium</BrowserName>
|
||||
<LaunchOptions>
|
||||
<Headless>false</Headless>
|
||||
<Channel>msedge</Channel>
|
||||
</LaunchOptions>
|
||||
</Playwright>
|
||||
</RunSettings>
|
||||
```
|
||||
|
||||
```bash tab=bash-bash
|
||||
dotnet test -- TestRunParameters.Parameter\(name=\"browser\", value=\"chromium\"\) TestRunParameters.Parameter\(name=\"headless\", value=\"false\"\) TestRunParameters.Parameter\(name=\"channel\", value=\"msedge\"\)
|
||||
```
|
||||
|
||||
```batch tab=bash-batch
|
||||
dotnet test -- TestRunParameters.Parameter(name=\"browser\", value=\"chromium\") TestRunParameters.Parameter(name=\"headless\", value=\"false\") TestRunParameters.Parameter(name=\"channel\", value=\"msedge\")
|
||||
```
|
||||
|
||||
```powershell tab=bash-powershell
|
||||
dotnet test -- TestRunParameters.Parameter(name=\"browser\", value=\"chromium\") TestRunParameters.Parameter(name=\"headless\", value=\"false\") TestRunParameters.Parameter(name=\"channel\", value=\"msedge\")
|
||||
```bash
|
||||
dotnet test -- Playwright.BrowserName=chromium Playwright.LaunchOptions.Headless=false Playwright.LaunchOptions.Channel=msedge
|
||||
```
|
||||
|
||||
### Using Verbose API Logs
|
||||
@ -389,32 +381,35 @@ When you have enabled the [verbose API log](./debug.md#verbose-api-logs), via th
|
||||
|
||||
### Using the .runsettings file
|
||||
|
||||
When running tests from Visual Studio, you can take advantage of the `.runsettings` file.
|
||||
When running tests from Visual Studio, you can take advantage of the `.runsettings` file. The following shows a reference of the supported values.
|
||||
|
||||
For example, to specify the amount of workers (`MSTest.Parallelize.Workers`), you can use the following snippet:
|
||||
For example, to specify the number of workers, you can use `MSTest.Parallelize.Workers`. You can also enable `DEBUG` logs using `RunConfiguration.EnvironmentVariables`.
|
||||
|
||||
```xml
|
||||
<RunSettings>
|
||||
<!-- MSTest adapter -->
|
||||
<!-- MSTest adapter -->
|
||||
<MSTest>
|
||||
<Parallelize>
|
||||
<Workers>4</Workers>
|
||||
<Scope>ClassLevel</Scope>
|
||||
</Parallelize>
|
||||
</MSTest>
|
||||
</RunSettings>
|
||||
```
|
||||
|
||||
If you want to enable debugging, you can set the `DEBUG` variable to `pw:api` as documented, by doing:
|
||||
|
||||
```xml
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RunSettings>
|
||||
<!-- General run configuration -->
|
||||
<RunConfiguration>
|
||||
<EnvironmentVariables>
|
||||
<!-- For debugging selectors, it's recommend to set the following environment variable -->
|
||||
<DEBUG>pw:api</DEBUG>
|
||||
</EnvironmentVariables>
|
||||
</RunConfiguration>
|
||||
<!-- Playwright -->
|
||||
<Playwright>
|
||||
<BrowserName>chromium</BrowserName>
|
||||
<ExpectTimeout>5000</ExpectTimeout>
|
||||
<LaunchOptions>
|
||||
<Headless>false</Headless>
|
||||
<Channel>msedge</Channel>
|
||||
</LaunchOptions>
|
||||
</Playwright>
|
||||
</RunSettings>
|
||||
```
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user