[dotnet] [test] In-process test webserver#17339
[dotnet] [test] In-process test webserver#17339nvborisenko merged 20 commits intoSeleniumHQ:trunkfrom
Conversation
Review Summary by QodoReplace Java test webserver with in-process .NET ASP.NET Core implementation
WalkthroughsDescription• Replaces Java-based test webserver with in-process .NET ASP.NET Core implementation • Adds Selenium.Testing.WebServer project with HTTP handlers for test scenarios • Simplifies test infrastructure by removing external process management • Updates test configuration to use dynamic port allocation and /common path mapping File Changes1. dotnet/test/testing.webserver/AppServer.cs
|
Code Review by Qodo
|
|
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. |
There was a problem hiding this comment.
Pull request overview
This PR replaces the existing Java-based external test webserver dependency for the .NET test suite with a new in-process ASP.NET Core-based test webserver, and updates .NET test/build wiring to use it.
Changes:
- Added a new
dotnet/test/testing.webserverproject implementing an in-process ASP.NET Core test server (AppServer) plus several test handlers. - Updated the .NET test environment (
EnvironmentManager,UrlBuilder, config) and some tests to use sharedcommon/src/webfixtures via the new server. - Updated solution/Bazel build definitions to include the new webserver project and remove Java appserver/keystore dependencies.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| dotnet/test/webdriver/Selenium.WebDriver.Tests.csproj | References the new test webserver project; removes Java appserver build target. |
| dotnet/test/webdriver/PositionAndSizeTests.cs | Uses invariant-culture decimal parsing for CSS pixel values. |
| dotnet/test/webdriver/Infrastructure/Environment/UrlBuilder.cs | Simplifies URL construction to target the new in-process server and shared /common paths. |
| dotnet/test/webdriver/Infrastructure/Environment/TestWebServer.cs | Removes the old external-process Java webserver wrapper. |
| dotnet/test/webdriver/Infrastructure/Environment/TestEnvironment.cs | Removes website/server config fields no longer needed with in-process hosting. |
| dotnet/test/webdriver/Infrastructure/Environment/EnvironmentManager.cs | Starts the new in-process AppServer and updates URL building/root discovery. |
| dotnet/test/webdriver/CookieImplementationTests.cs | Updates paths/pages to align with shared common/src/web content layout. |
| dotnet/test/webdriver/BUILD.bazel | Removes Java appserver/keystore data; adds web SDK and new webserver dep. |
| dotnet/test/webdriver/appconfig.json | Removes website/webserver configuration sections. |
| dotnet/test/testing.webserver/Selenium.Testing.WebServer.csproj | New .NET test webserver project definition (ASP.NET Core framework reference). |
| dotnet/test/testing.webserver/Handlers/Utf8Handler.cs | New handler to serve UTF-8 content from shared web fixtures. |
| dotnet/test/testing.webserver/Handlers/UploadHandler.cs | New handler for upload test scenarios. |
| dotnet/test/testing.webserver/Handlers/SleepHandler.cs | New handler that delays responses for page load timeout tests. |
| dotnet/test/testing.webserver/Handlers/RedirectHandler.cs | New handler for redirect scenarios. |
| dotnet/test/testing.webserver/Handlers/PageHandler.cs | New handler to generate simple numbered pages. |
| dotnet/test/testing.webserver/Handlers/FedCmHandler.cs | New handler endpoints for FedCM-related scenarios. |
| dotnet/test/testing.webserver/Handlers/EncodingHandler.cs | New handler serving UTF-16 content for encoding tests. |
| dotnet/test/testing.webserver/Handlers/EchoHandler.cs | New handler echoing request data back to the client. |
| dotnet/test/testing.webserver/Handlers/CreatePageHandler.cs | New handler to create and serve dynamically generated pages. |
| dotnet/test/testing.webserver/Handlers/CookieHandler.cs | New handler to add/delete cookies via response headers. |
| dotnet/test/testing.webserver/Handlers/BasicAuthHandler.cs | New handler implementing basic auth challenge/response behavior. |
| dotnet/test/testing.webserver/BUILD.bazel | New Bazel target for the in-process webserver library and its shared web data. |
| dotnet/test/testing.webserver/AppServer.cs | New in-process ASP.NET Core server that maps handlers and serves shared static fixtures. |
| dotnet/test/support/Selenium.WebDriver.Support.Tests.csproj | Adds project reference to the new test webserver. |
| dotnet/test/support/BUILD.bazel | Adds web SDK and new webserver dep for support tests. |
| dotnet/test/remote/BUILD.bazel | Adds web SDK and new webserver dep for remote tests. |
| dotnet/Selenium.slnx | Adds the new test webserver project to the .NET solution. |
| dotnet/private/dotnet_nunit_test_suite.bzl | Adjusts browser arg selection logic (notably removing default skipping/local-driver handling). |
dotnet/test/webdriver/Infrastructure/Environment/EnvironmentManager.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
This PR replaces the .NET test infrastructure’s dependency on the Java “appserver” with a new in-process ASP.NET Core-based test web server, and wires it into the .NET test projects/build graph to better align with other language bindings’ internal testing approach.
Changes:
- Added a new
Selenium.Testing.WebServer.NET project implementing an in-process ASP.NET Core test server with multiple test endpoints and access to sharedcommon/src/webfixtures. - Updated .NET test infrastructure to use the new in-process server (removing external Java webserver build/process management and associated config).
- Updated Bazel and solution/project references to include the new webserver project and required SDK settings.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| dotnet/test/webdriver/Selenium.WebDriver.Tests.csproj | Adds reference to new test webserver project; removes Bazel “build Java appserver” target. |
| dotnet/test/webdriver/PositionAndSizeTests.cs | Uses invariant-culture parsing for CSS pixel values. |
| dotnet/test/webdriver/Infrastructure/Environment/UrlBuilder.cs | Simplifies URL construction (host/port) and hardcodes /common base path. |
| dotnet/test/webdriver/Infrastructure/Environment/TestWebServer.cs | Removes external-process Java test webserver wrapper. |
| dotnet/test/webdriver/Infrastructure/Environment/TestEnvironment.cs | Removes website/webserver configuration fields no longer used. |
| dotnet/test/webdriver/Infrastructure/Environment/EnvironmentManager.cs | Switches to AppServer usage and adds project-root discovery helper. |
| dotnet/test/webdriver/CookieImplementationTests.cs | Updates cookie test navigation paths to /common and adjusts setup page. |
| dotnet/test/webdriver/BUILD.bazel | Removes Java webserver/keystore data deps; adds new webserver dep and project_sdk = "web". |
| dotnet/test/webdriver/appconfig.json | Removes Java webserver + website configuration blocks. |
| dotnet/test/testing.webserver/Selenium.Testing.WebServer.csproj | Introduces new test-only webserver project with ASP.NET Core framework reference. |
| dotnet/test/testing.webserver/Handlers/Utf8Handler.cs | Adds UTF-8 content handler for test pages. |
| dotnet/test/testing.webserver/Handlers/UploadHandler.cs | Adds upload endpoint handler used by upload-related tests. |
| dotnet/test/testing.webserver/Handlers/SleepHandler.cs | Adds sleep/delay endpoint handler used for timing-related tests. |
| dotnet/test/testing.webserver/Handlers/RedirectHandler.cs | Adds redirect endpoint handler. |
| dotnet/test/testing.webserver/Handlers/PageHandler.cs | Adds dynamic “page/{pageNumber}” handler. |
| dotnet/test/testing.webserver/Handlers/FedCmHandler.cs | Adds FedCM-related endpoints for tests. |
| dotnet/test/testing.webserver/Handlers/EncodingHandler.cs | Adds UTF-16 encoding test endpoint. |
| dotnet/test/testing.webserver/Handlers/EchoHandler.cs | Adds request echo endpoint handler. |
| dotnet/test/testing.webserver/Handlers/CreatePageHandler.cs | Adds endpoint to create/serve temporary inline pages for tests. |
| dotnet/test/testing.webserver/Handlers/CookieHandler.cs | Adds cookie set/delete endpoint handler. |
| dotnet/test/testing.webserver/Handlers/BasicAuthHandler.cs | Adds basic-auth endpoint handler. |
| dotnet/test/testing.webserver/BUILD.bazel | Adds Bazel csharp_library target for the new webserver project and includes common web fixtures as data. |
| dotnet/test/testing.webserver/AppServer.cs | Implements the in-process ASP.NET Core server and endpoint/static-file mappings. |
| dotnet/test/support/Selenium.WebDriver.Support.Tests.csproj | Adds reference to new test webserver project. |
| dotnet/test/support/BUILD.bazel | Adds new webserver dep and project_sdk = "web" for support tests. |
| dotnet/test/remote/BUILD.bazel | Adds new webserver dep and project_sdk = "web" for remote tests. |
| dotnet/Selenium.slnx | Registers the new test webserver project in the .NET solution. |
| dotnet/private/dotnet_nunit_test_suite.bzl | Simplifies default browser arg selection (removes default skip conditions). |
There was a problem hiding this comment.
Pull request overview
This PR replaces the Java-based Selenium test webserver used by .NET tests with a new in-process ASP.NET Core-based server (OpenQA.Selenium.Testing.WebServer) and rewires the .NET test infrastructure/build files to use it.
Changes:
- Added a new
Selenium.Testing.WebServertest-only project implementing an in-process ASP.NET Core server with common test endpoints and static file hosting. - Updated .NET test infrastructure (
EnvironmentManager,UrlBuilder, configs) to start and use the new server instead of building/running the Java appserver. - Updated Bazel + solution/project wiring to include the new webserver dependency and use the
webSDK where needed.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| dotnet/test/webdriver/Selenium.WebDriver.Tests.csproj | Adds reference to the new webserver project; removes Java appserver build target. |
| dotnet/test/webdriver/PositionAndSizeTests.cs | Uses invariant-culture decimal parsing for CSS numeric assertions. |
| dotnet/test/webdriver/Infrastructure/Environment/UrlBuilder.cs | Refactors URL composition to work with http/https base URLs from the new server. |
| dotnet/test/webdriver/Infrastructure/Environment/TestWebServer.cs | Removes the external-process Java appserver wrapper. |
| dotnet/test/webdriver/Infrastructure/Environment/TestEnvironment.cs | Removes website/webserver config fields no longer used. |
| dotnet/test/webdriver/Infrastructure/Environment/EnvironmentManager.cs | Starts the new in-process AppServer and initializes UrlBuilder with returned base URLs. |
| dotnet/test/webdriver/CookieImplementationTests.cs | Updates test navigation and cookie paths to the /common layout. |
| dotnet/test/webdriver/BUILD.bazel | Drops Java server artifacts; adds web SDK + new webserver dep. |
| dotnet/test/webdriver/appconfig.json | Removes website and Java webserver configuration sections. |
| dotnet/test/testing.webserver/Selenium.Testing.WebServer.csproj | Introduces the new ASP.NET Core-backed test webserver project. |
| dotnet/test/testing.webserver/Handlers/Utf8Handler.cs | Adds a handler to serve UTF-8 test pages from disk. |
| dotnet/test/testing.webserver/Handlers/UploadHandler.cs | Adds an upload endpoint with an intentional delay for wait-related tests. |
| dotnet/test/testing.webserver/Handlers/SleepHandler.cs | Adds a delay endpoint driven by query string. |
| dotnet/test/testing.webserver/Handlers/RedirectHandler.cs | Adds a redirect endpoint used by navigation tests. |
| dotnet/test/testing.webserver/Handlers/PageHandler.cs | Adds a dynamic page generator endpoint. |
| dotnet/test/testing.webserver/Handlers/FedCmHandler.cs | Adds FedCM-related JSON endpoints for authentication tests. |
| dotnet/test/testing.webserver/Handlers/EncodingHandler.cs | Adds a UTF-16 response endpoint for encoding tests. |
| dotnet/test/testing.webserver/Handlers/EchoHandler.cs | Adds an endpoint that echoes method/headers/body into an HTML response. |
| dotnet/test/testing.webserver/Handlers/CreatePageHandler.cs | Adds an endpoint for creating and serving temporary inline pages. |
| dotnet/test/testing.webserver/Handlers/CookieHandler.cs | Adds a cookie manipulation endpoint for cookie tests. |
| dotnet/test/testing.webserver/Handlers/BasicAuthHandler.cs | Adds a basic-auth challenge/response endpoint. |
| dotnet/test/testing.webserver/BUILD.bazel | Adds Bazel build target for the new webserver + common web fixtures data. |
| dotnet/test/testing.webserver/AppServer.cs | Implements the in-process ASP.NET Core server, endpoints, and static file hosting. |
| dotnet/test/support/Selenium.WebDriver.Support.Tests.csproj | Adds reference to the new webserver project. |
| dotnet/test/support/BUILD.bazel | Enables web SDK and adds new webserver dep. |
| dotnet/test/remote/BUILD.bazel | Enables web SDK and adds new webserver dep. |
| dotnet/Selenium.slnx | Adds the new webserver project to the .NET solution. |
| dotnet/private/dotnet_nunit_test_suite.bzl | Simplifies default browser selection logic (removes default --where=SkipTest==True for some browsers). |
There was a problem hiding this comment.
Pull request overview
This PR replaces the Java-based test webserver dependency for .NET Selenium tests with an in-process ASP.NET Core test webserver, aiming to simplify test infrastructure and speed up test runs while reusing the shared common/ HTML fixtures.
Changes:
- Added a new
dotnet/test/testing.webserverproject implementing an in-process ASP.NET CoreAppServerwith multiple test endpoints. - Updated .NET test infrastructure (
EnvironmentManager,UrlBuilder, cookie tests) to use the new server and/common/...URL shape. - Updated solution/Bazel wiring to build/run tests with the new webserver and removed Java appserver build/data dependencies.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| dotnet/test/webdriver/Selenium.WebDriver.Tests.csproj | References the new .NET test webserver project; removes Java appserver build target. |
| dotnet/test/webdriver/PositionAndSizeTests.cs | Makes CSS numeric parsing culture-invariant. |
| dotnet/test/webdriver/Infrastructure/Environment/UrlBuilder.cs | Reworks URL composition around provided http/https base URLs and /common prefix. |
| dotnet/test/webdriver/Infrastructure/Environment/TestWebServer.cs | Removes the external-process Java appserver harness. |
| dotnet/test/webdriver/Infrastructure/Environment/TestEnvironment.cs | Removes website/webserver config fields no longer used. |
| dotnet/test/webdriver/Infrastructure/Environment/EnvironmentManager.cs | Starts the in-process AppServer and constructs UrlBuilder from returned URLs. |
| dotnet/test/webdriver/CookieImplementationTests.cs | Updates cookie-path expectations and startup navigation for /common URLs. |
| dotnet/test/webdriver/BUILD.bazel | Drops Java webserver/keystore from data; adds dependency on the new webserver and uses project_sdk = "web". |
| dotnet/test/webdriver/appconfig.json | Removes website/webserver configuration blocks. |
| dotnet/test/testing.webserver/Selenium.Testing.WebServer.csproj | Introduces the new test-only webserver project (net8.0 + ASP.NET Core). |
| dotnet/test/testing.webserver/BUILD.bazel | Adds Bazel target for the test webserver and includes shared //common/src/web data. |
| dotnet/test/testing.webserver/AppServer.cs | Implements the ASP.NET Core in-process server and endpoint wiring. |
| dotnet/test/testing.webserver/Handlers/BasicAuthHandler.cs | Adds basic auth endpoint handler. |
| dotnet/test/testing.webserver/Handlers/CookieHandler.cs | Adds cookie manipulation endpoint handler. |
| dotnet/test/testing.webserver/Handlers/CreatePageHandler.cs | Adds endpoint for creating/serving inline pages. |
| dotnet/test/testing.webserver/Handlers/EchoHandler.cs | Adds endpoint that echoes request method/headers/body. |
| dotnet/test/testing.webserver/Handlers/EncodingHandler.cs | Adds UTF-16 content endpoint for encoding tests. |
| dotnet/test/testing.webserver/Handlers/FedCmHandler.cs | Adds FedCM-related endpoints for tests. |
| dotnet/test/testing.webserver/Handlers/PageHandler.cs | Adds dynamic page endpoint. |
| dotnet/test/testing.webserver/Handlers/RedirectHandler.cs | Adds redirect endpoint handler. |
| dotnet/test/testing.webserver/Handlers/SleepHandler.cs | Adds latency endpoint handler. |
| dotnet/test/testing.webserver/Handlers/UploadHandler.cs | Adds upload endpoint handler. |
| dotnet/test/testing.webserver/Handlers/Utf8Handler.cs | Adds handler for serving UTF-8 HTML fixtures. |
| dotnet/test/support/Selenium.WebDriver.Support.Tests.csproj | References the new test webserver project. |
| dotnet/test/support/BUILD.bazel | Adds dependency on new test webserver and uses project_sdk = "web". |
| dotnet/test/remote/BUILD.bazel | Adds dependency on new test webserver and uses project_sdk = "web". |
| dotnet/Selenium.slnx | Registers the new test webserver project in the solution. |
| dotnet/private/dotnet_nunit_test_suite.bzl | Adjusts default browser args selection behavior (removes default skip). |
Don't use Java test webserver, use dotnet based.
🔗 Related Issues
Contributes to #15536
💥 What does this PR do?
This pull request introduces a reusable .NET test web server for Selenium tests and integrates it into the test infrastructure. The main changes include adding the new
Selenium.Testing.WebServerproject, implementing various HTTP handlers for test scenarios, and updating test builds to consume the new web server.Addition of reusable test web server:
Selenium.Testing.WebServerproject (Selenium.Testing.WebServer.csproj) containing theAppServerclass, which hosts an ASP.NET Core web server for Selenium tests. This server provides endpoints for authentication, cookies, echoing requests, custom page creation, file uploads, and more. [1] [2]BasicAuthHandler,CookieHandler,CreatePageHandler,EchoHandler, andEncodingHandler, each providing HTTP endpoints for Selenium test scenarios. [1] [2] [3] [4] [5]Integration into test infrastructure:
Selenium.slnx) and as a dependency in relevant test projects and Bazel build files, ensuring that test suites can use the shared web server. [1] [2] [3] [4]Test suite configuration improvements:
project_sdk = "web"and add the web server as a dependency for remote and support test suites, enabling seamless use of the test server in test runs. [1] [2]Cleanup of test suite parameters:
_BROWSERSwithindotnet_nunit_test_suite.bzlby removing the default skip condition for unsupported browsers, making test execution logic more straightforward. [1] [2] [3]🔧 Implementation Notes
New
testingnamespace for testing :)🔄 Types of changes