Replace WebApplicationFactory in tests with WebApplicationBuilder#2014
Merged
Conversation
bkoelman
force-pushed
the
replace-web-application-factory
branch
2 times, most recently
from
May 26, 2026 01:38
9b4fde2 to
c7f5032
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2014 +/- ##
==========================================
- Coverage 92.12% 91.96% -0.16%
==========================================
Files 438 438
Lines 15044 15044
Branches 2488 2488
==========================================
- Hits 13859 13835 -24
- Misses 731 755 +24
Partials 454 454 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
bkoelman
force-pushed
the
replace-web-application-factory
branch
4 times, most recently
from
July 5, 2026 08:27
030965e to
0b87b53
Compare
bkoelman
force-pushed
the
replace-web-application-factory
branch
from
July 6, 2026 06:41
caeb73c to
c9e6cf0
Compare
bkoelman
marked this pull request as ready for review
July 6, 2026 07:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All integration tests currently use
WebApplicationFactory, which is designed to run tests against an existing app. It sets the content root, solution root and startup project, enables overriding service container entries and more.But nowadays, most integration tests no longer reference an actual app; they run entirely in a test project. We've been fighting the defaults of
WebApplicationFactoryto enable that, but keep running into limitations. For example, constraints apply to where the Startup class can be defined. For integration tests that don't reference an actual app, it makes more sense to use the underlyingTestServerdirectly against a freshly built app usingWebApplicationBuilder.This PR replaces
WebApplicationFactoryusage with the direct approach for all integration tests that don't reference an actual app. It also optimizes database throttling and timeouts to better handle PostgreSQL's maximum connection limits during test runs. TheFactoryBridgetemporary type was introduced to avoid adapting all existing tests, so this PR focuses only on the test infrastructure.QUALITY CHECKLIST