mirror of
				https://github.com/microsoft/playwright.git
				synced 2025-06-26 21:40:17 +00: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 | - Running Tests on specific browsers | ||||||
| 
 | 
 | ||||||
|   ```bash tab=bash-bash |   ```bash | ||||||
|   BROWSER=webkit dotnet test |   dotnet test -- Playwright.BrowserName=webkit | ||||||
|   ``` |  | ||||||
| 
 |  | ||||||
|   ```batch tab=bash-batch |  | ||||||
|   set BROWSER=webkit |  | ||||||
|   dotnet test |  | ||||||
|   ``` |  | ||||||
| 
 |  | ||||||
|   ```powershell tab=bash-powershell |  | ||||||
|   $env:BROWSER="webkit" |  | ||||||
|   dotnet test |  | ||||||
|   ``` |   ``` | ||||||
| 
 | 
 | ||||||
| - Running Tests on multiple browsers | - 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 |   ```bash | ||||||
|   dotnet test --settings:chromium.runsettings |   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 | ||||||
|   <?xml version="1.0" encoding="utf-8"?> |   <?xml version="1.0" encoding="utf-8"?> | ||||||
|   <RunSettings> |   <RunSettings> | ||||||
|     <TestRunParameters> |     <Playwright> | ||||||
|       <Parameter name="browser" value="chromium" /> |       <BrowserName>chromium</BrowserName> | ||||||
|       <Parameter name="headless" value="false" /> |     </Playwright> | ||||||
|     </TestRunParameters> |  | ||||||
|   </RunSettings> |   </RunSettings> | ||||||
|   ``` |   ``` | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -154,24 +154,18 @@ CLI. See the following example: | |||||||
| ```xml | ```xml | ||||||
| <?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||||
| <RunSettings> | <RunSettings> | ||||||
|   <TestRunParameters> |   <Playwright> | ||||||
|     <Parameter name="browser" value="chromium" /> |     <BrowserName>chromium</BrowserName> | ||||||
|     <Parameter name="headless" value="false" /> |     <LaunchOptions> | ||||||
|     <Parameter name="channel" value="msedge" /> |       <Headless>false</Headless> | ||||||
|   </TestRunParameters> |       <Channel>msedge</Channel> | ||||||
|  |     </LaunchOptions> | ||||||
|  |   </Playwright> | ||||||
| </RunSettings> | </RunSettings> | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash tab=bash-bash | ```bash | ||||||
| dotnet test -- TestRunParameters.Parameter\(name=\"browser\", value=\"chromium\"\) TestRunParameters.Parameter\(name=\"headless\", value=\"false\"\) TestRunParameters.Parameter\(name=\"channel\", value=\"msedge\"\) | dotnet test -- Playwright.BrowserName=chromium Playwright.LaunchOptions.Headless=false Playwright.LaunchOptions.Channel=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\") |  | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ### Using Verbose API Logs | ### 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 | ### 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 | ||||||
| <?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||||
| <RunSettings> | <RunSettings> | ||||||
|  |   <!-- NUnit adapter -->   | ||||||
|   <NUnit> |   <NUnit> | ||||||
|     <NumberOfTestWorkers>24</NumberOfTestWorkers> |     <NumberOfTestWorkers>24</NumberOfTestWorkers> | ||||||
|   </NUnit> |   </NUnit> | ||||||
| </RunSettings> |   <!-- General run configuration --> | ||||||
| ``` |  | ||||||
| 
 |  | ||||||
| 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> |  | ||||||
|   <RunConfiguration> |   <RunConfiguration> | ||||||
|     <EnvironmentVariables> |     <EnvironmentVariables> | ||||||
|  |       <!-- For debugging selectors, it's recommend to set the following environment variable --> | ||||||
|       <DEBUG>pw:api</DEBUG> |       <DEBUG>pw:api</DEBUG> | ||||||
|     </EnvironmentVariables> |     </EnvironmentVariables> | ||||||
|   </RunConfiguration> |   </RunConfiguration> | ||||||
|  |   <!-- Playwright -->   | ||||||
|  |   <Playwright> | ||||||
|  |     <BrowserName>chromium</BrowserName> | ||||||
|  |     <ExpectTimeout>5000</ExpectTimeout> | ||||||
|  |     <LaunchOptions> | ||||||
|  |       <Headless>true</Headless> | ||||||
|  |       <Channel>msedge</Channel> | ||||||
|  |     </LaunchOptions> | ||||||
|  |   </Playwright> | ||||||
| </RunSettings> | </RunSettings> | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| @ -363,24 +361,18 @@ CLI. See the following example: | |||||||
| ```xml | ```xml | ||||||
| <?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||||
| <RunSettings> | <RunSettings> | ||||||
|   <TestRunParameters> |   <Playwright> | ||||||
|     <Parameter name="browser" value="chromium" /> |     <BrowserName>chromium</BrowserName> | ||||||
|     <Parameter name="headless" value="false" /> |     <LaunchOptions> | ||||||
|     <Parameter name="channel" value="msedge" /> |       <Headless>false</Headless> | ||||||
|   </TestRunParameters> |       <Channel>msedge</Channel> | ||||||
|  |     </LaunchOptions> | ||||||
|  |   </Playwright> | ||||||
| </RunSettings> | </RunSettings> | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash tab=bash-bash | ```bash | ||||||
| dotnet test -- TestRunParameters.Parameter\(name=\"browser\", value=\"chromium\"\) TestRunParameters.Parameter\(name=\"headless\", value=\"false\"\) TestRunParameters.Parameter\(name=\"channel\", value=\"msedge\"\) | dotnet test -- Playwright.BrowserName=chromium Playwright.LaunchOptions.Headless=false Playwright.LaunchOptions.Channel=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\") |  | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ### Using Verbose API Logs | ### Using Verbose API Logs | ||||||
| @ -389,9 +381,9 @@ When you have enabled the [verbose API log](./debug.md#verbose-api-logs), via th | |||||||
| 
 | 
 | ||||||
| ### Using the .runsettings file | ### 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 | ```xml | ||||||
| <RunSettings> | <RunSettings> | ||||||
| @ -402,19 +394,22 @@ For example, to specify the amount of workers (`MSTest.Parallelize.Workers`), yo | |||||||
|       <Scope>ClassLevel</Scope> |       <Scope>ClassLevel</Scope> | ||||||
|     </Parallelize> |     </Parallelize> | ||||||
|   </MSTest> |   </MSTest> | ||||||
| </RunSettings> |   <!-- General run configuration --> | ||||||
| ``` |  | ||||||
| 
 |  | ||||||
| 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> |  | ||||||
|   <RunConfiguration> |   <RunConfiguration> | ||||||
|     <EnvironmentVariables> |     <EnvironmentVariables> | ||||||
|  |       <!-- For debugging selectors, it's recommend to set the following environment variable --> | ||||||
|       <DEBUG>pw:api</DEBUG> |       <DEBUG>pw:api</DEBUG> | ||||||
|     </EnvironmentVariables> |     </EnvironmentVariables> | ||||||
|   </RunConfiguration> |   </RunConfiguration> | ||||||
|  |   <!-- Playwright -->   | ||||||
|  |   <Playwright> | ||||||
|  |     <BrowserName>chromium</BrowserName> | ||||||
|  |     <ExpectTimeout>5000</ExpectTimeout> | ||||||
|  |     <LaunchOptions> | ||||||
|  |       <Headless>false</Headless> | ||||||
|  |       <Channel>msedge</Channel> | ||||||
|  |     </LaunchOptions> | ||||||
|  |   </Playwright> | ||||||
| </RunSettings> | </RunSettings> | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Max Schmitt
						Max Schmitt