Repository navigation
[dotnet] [test] Parallelize internal testing - #18110
Conversation
|
Thank you, @nvborisenko for this code suggestion. The support packages contain example code that many users find helpful, but they do not necessarily represent After reviewing the change, unless it is a critical fix or a feature that is needed for Selenium We actively encourage people to add the wrapper and helper code that makes sense for them to their own frameworks. |
PR Summary by QodoParallelize .NET test fixtures with fixture-owned browser drivers
AI Description
Diagram
High-Level Assessment
Files changed (33)
|
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Blanket parallelization races process-global logging tests and attempts unsupported concurrent Safari sessions.
Review effort: Balanced
Findings: 1
What changed in this PR
Refactors .NET test driver ownership to support fixture-level parallel execution.
Changes:
- Moves driver creation into
DriverFactoryand lifecycle management into fixtures. - Enables parallel fixture execution across test assemblies.
- Migrates tests and wait helpers to fixture-local drivers.
Risk: Test infrastructure only; no cross-binding API impact.
| File | Description |
|---|---|
dotnet/test/webdriver/UnexpectedAlertBehaviorTests.cs |
Uses fixture-local lifecycle helpers. |
dotnet/test/webdriver/TimeoutDriverOptionsTests.cs |
Creates drivers through DriverFactory. |
dotnet/test/webdriver/SessionHandlingTests.cs |
Migrates session lifecycle handling. |
dotnet/test/webdriver/ProxySettingTests.cs |
Hooks driver-start events per fixture. |
dotnet/test/webdriver/PageLoadingTests.cs |
Uses fixture-local and additional drivers. |
dotnet/test/webdriver/DownloadsTests.cs |
Migrates custom driver lifecycle. |
dotnet/test/webdriver/DevTools/DevToolsTestFixture.cs |
Manages DevTools drivers per fixture. |
dotnet/test/webdriver/CorrectEventFiringTests.cs |
Creates secondary drivers via fixture helper. |
dotnet/test/webdriver/CookieImplementationTests.cs |
Refreshes the fixture-owned driver. |
dotnet/test/webdriver/BiDi/BiDiFixture.cs |
Uses the new factory for BiDi drivers. |
dotnet/test/webdriver/AssemblyFixture.cs |
Enables fixture-level parallelism. |
dotnet/test/webdriver/AlertsTests.cs |
Uses fixture-local driver closure. |
dotnet/test/testing.nunit/NeedsFreshDriverAttribute.cs |
Refreshes drivers through fixture APIs. |
dotnet/test/testing.nunit/Environment/EnvironmentManager.cs |
Removes shared driver state. |
dotnet/test/testing.nunit/Environment/DriverFactory.cs |
Centralizes cached driver resolution and creation. |
dotnet/test/testing.nunit/DriverTestFixture.cs |
Owns driver factory and lifecycle per fixture. |
dotnet/test/testing.nunit/DriverConfigs/StableChannelFirefoxDriver.cs |
Updates factory reference comment. |
dotnet/test/testing.nunit/DriverConfigs/StableChannelEdgeDriver.cs |
Updates factory reference comment. |
dotnet/test/testing.nunit/DriverConfigs/StableChannelChromeDriver.cs |
Updates factory reference comment. |
dotnet/test/testing.nunit/DriverConfigs/SafariTechnologyPreviewDriver.cs |
Updates factory reference comment. |
dotnet/test/testing.nunit/DriverConfigs/NightlyChannelFirefoxDriver.cs |
Updates factory reference comment. |
dotnet/test/testing.nunit/DriverConfigs/EdgeInternetExplorerModeDriver.cs |
Updates factory reference comment. |
dotnet/test/testing.nunit/DriverConfigs/DevChannelEdgeDriver.cs |
Updates factory reference comment. |
dotnet/test/testing.nunit/DriverConfigs/DevChannelChromeDriver.cs |
Updates factory reference comment. |
dotnet/test/testing.nunit/DriverConfigs/DefaultSafariDriver.cs |
Updates factory reference comment. |
dotnet/test/testing.nunit/AssemblyFixtureBase.cs |
Removes assembly-wide driver cleanup. |
dotnet/test/support/AssemblyFixture.cs |
Enables fixture-level parallelism. |
dotnet/test/remote/RemoteWebDriverSpecificTests.cs |
Uses fixture-local driver closure. |
dotnet/test/remote/AssemblyTeardown.cs |
Enables fixture-level parallelism. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Good big step! |

Enable parallel tests execution per fixture.
Before (Chrome):
After (Chrome):
Firefox (before/after):
🔗 Related Issues
Contributes to #15536
💥 What does this PR do?
This pull request refactors the test infrastructure to improve driver management and parallelization in the .NET Selenium test suite. The main changes include introducing a new
DriverFactoryfor driver creation, removing driver lifecycle management fromEnvironmentManager, and enabling parallel test execution at the fixture level. Several test fixtures and driver configuration classes are updated to use the new approach.Test Infrastructure Refactoring:
DriverFactoryclass that handles driver instantiation, including resolving driver types and managing headless options, replacing the previous approach inEnvironmentManager. This centralizes and simplifies driver creation logic. [1] [2] [3] [4] [5] [6]DefaultSafariDriver,DevChannelChromeDriver, etc.) to referenceDriverFactory.CreateDriver(options)instead of the oldEnvironmentManager.Instance.CreateDriverInstance(options). [1] [2] [3] [4] [5] [6] [7] [8] [9]Driver Lifecycle Management:
EnvironmentManagertoDriverTestFixtureand its subclasses, introducing new helper methods likeCreateDriverInstance,CloseDriver, andCreateFreshDriver. [1] [2]NeedsFreshDriverAttributeto use the new fixture-based driver management rather than interacting withEnvironmentManagerdirectly.Parallelization Improvements:
[assembly: Parallelizable(ParallelScope.Fixtures)]to relevant test assemblies. [1] [2]Other Notable Changes:
WaitFor<T>method inDriverTestFixtureto useDefaultWait<Func<T>>instead ofWebDriverWait, making it independent of the fixture driver and more flexible.EnvironmentManager, including driver instance storage and event handling, making it a stateless provider of environment configuration. [1] [2] [3] [4]These changes collectively modernize the test infrastructure, improve reliability for parallel test runs, and make driver management more modular and maintainable.
🔧 Implementation Notes
🤖 AI assistance
💡 Additional Considerations
Here we don't enable parallelization at test level. At fixture level is good enough.
🔄 Types of changes