Integration test host: clean shutdown and readable output - #323
Open
damyanpetev wants to merge 4 commits into
Open
Integration test host: clean shutdown and readable output#323damyanpetev wants to merge 4 commits into
damyanpetev wants to merge 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the Ignite UI Blazor Lite integration test infrastructure by making the test host lifecycle deterministic (clean shutdown of the Kestrel host) and by reducing/attributing host logging to the currently running test. It also enhances component test runs by returning a structured per-component run summary from the TestBed, so tests can report what was exercised and fail when the component didn’t actually render.
Changes:
- Stop Kestrel via
StopAsyncduring teardown (instead of only disposing) and close the browser context before stopping the host to avoid intermittent SignalR/circuit disposal races. - Route host logs into NUnit test output via a custom
ILoggerProvider, and describe host startup details once per run. - Return a
ComponentRunSummaryfromSetComponentTypeand surface it through JS + Playwright to report per-component coverage and detect “didn’t render” failures.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/IgniteUI.Blazor.Lite.TestBed/wwwroot/app.js | Return the SetComponentType result to the test runner and log it as an object. |
| tests/IgniteUI.Blazor.Lite.TestBed/Components/Pages/Home.razor | Change SetComponentType to return ComponentRunSummary and track counts for exercised members. |
| tests/IgniteUI.Blazor.Lite.TestBed/Components/Common/ComponentRunSummary.cs | New DTO summarizing what a component run checked, including failure reason when it didn’t reach rendering. |
| tests/IgniteUI.Blazor.Lite.IntegrationTests/Infrastructure/TestOutputLoggerProvider.cs | New logger provider to route host logs into per-test output (and progress for errors). |
| tests/IgniteUI.Blazor.Lite.IntegrationTests/Infrastructure/BlazorPageTest.cs | Close browser context earlier in teardown and log host description once per run. |
| tests/IgniteUI.Blazor.Lite.IntegrationTests/Infrastructure/BlazorApplicationFactory.cs | Configure host logging and stop Kestrel host during disposal before disposing services. |
| tests/IgniteUI.Blazor.Lite.IntegrationTests/ComponentTest.cs | Consume and assert ComponentRunSummary, and print a readable per-component summary line. |
Comment on lines
+57
to
+60
| if (Context != null) | ||
| { | ||
| await Context.CloseAsync().ConfigureAwait(false); | ||
| } |
damyanpetev
force-pushed
the
dpetev/integration-test-logging
branch
from
August 7, 2026 15:03
625fb0b to
15632f1
Compare
damyanpetev
enabled auto-merge (rebase)
August 7, 2026 15:03
GetComponentByType prefixed the incoming name with Igb, but the names from TestUtil already carry it, so every lookup missed and each test bailed out before rendering anything. Dropping the prefix here rather than stripping it in TestUtil keeps the componentsConfig.json keys matching. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
1. Stop the Kestrel host instead of only disposing it
BlazorApplicationFactory.DisposeAsynccalledhost.Dispose()on the Kestrel host.IHost.Dispose()only disposes the service provider — it never callsStopAsync, soApplicationStoppingnever fired. That is the eventHttpConnectionManagerregistersCloseConnectionson, which is what disconnects live circuits (awaiting eachOnDisconnectedAsync) while the container is still alive.Without it, teardown was a race: closing the browser context returns as soon as the client side is gone, and the server noticed the dead socket whenever it got round to it. If that landed after the provider was disposed,
OnDisconnectedAsyncfailed on a disposedIServiceProvider— the intermittentObjectDisposedExceptionnoise in the logs, which never failed a test because the assertions had already completed.Teardown now
StopAsynces the host before disposing it, and closes the browser context first.BrowserTestcloses contexts too, but itsTearDownruns after the derived one and only when the test passed, so the close cannot be left to it;CloseAsyncis idempotent, so the base closing it again is a no-op.2. Quieter, test-attributed logging plus per-component coverage
Each test builds two hosts (TestServer + Kestrel) and each logged its full lifetime straight to the console — nine
info:lines per test, landing on whichever test the runner was reporting at the time.The host keeps
Warningand above only, viaPostConfigure<LoggerFilterOptions>(notSetMinimumLevel, which aDefaultrule inappsettings.jsonwould win over).What survives goes through
TestOutputLoggerProviderinto the current test's output, withErrorand above also written toTestContext.Progressso it surfaces regardless of runner verbosity.The startup details worth having — address, environment, content root — are read off the host and logged once per run.
SetComponentTypenow returns aComponentRunSummaryrather than abool, so each test reports what it covered:The
boolthat summary replaces was never checked by the test, so a component that never rendered — an unresolvable name, an instance that is not aBaseRendererControl— reported no errors and passed. The summary now carries aFailurestring instead, which the test asserts is null, along with a summary having been returned at all. Zero checks is left passing: 13 components are slot-only wrappers (IgbCardContent,IgbNavbar,IgbRipple, the various headers) with no settable API, and the summary line says so.