[dev-v5][Charts] Add unit tests#4978
Open
vnbaaij wants to merge 13 commits into
Open
Conversation
-Create one coverage report from both the Components and Component.Charts projects
- Add additional Chart tests (all at 100% now!) - Add additional Core tests to bring coverage to 98+% again - Moved _StartCodeCoverage to tests folder (1 up) - Added logic to _StartCodeCoverage.cmd to only run against changed test projects (and include option to force run)
|
✅ All tests passed successfully Details on your Workflow / Core Tests page. |
Summary - Unit Tests Code CoverageSummary
CoverageMicrosoft.FluentUI.AspNetCore.Components - 99%
Microsoft.FluentUI.AspNetCore.Components.Charts - 100%
Microsoft.FluentUI.AspNetCore.Components.Tests.Tools - 70.5%
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds extensive unit test coverage for the Charts package (and some additional Core components), introduces shared test infrastructure for snapshot verification, and updates local code-coverage tooling while excluding source-generation artifacts from coverage.
Changes:
- Add a new Charts test project and many new bUnit/xUnit tests with Verify snapshots for multiple chart components and models.
- Introduce a shared test project for common Verify/test utilities and wire it into existing test projects.
- Update local coverage scripts and exclude source-generated serialization contexts (and related code) from coverage calculations.
Reviewed changes
Copilot reviewed 42 out of 46 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Shared/Verify/FluentUITestContext.cs | Adds a shared bUnit test context helper for Verify-based tests. |
| tests/Shared/Verify/FluentAssertOptions.cs | Adds Verify configuration/options and scrubbing helpers for deterministic snapshots. |
| tests/Shared/Verify/FluentAssertExtensions.cs | Adds a string extension to scrub randomized Blazor attributes. |
| tests/Shared/Verify/FluentAssert.cs | Formatting/whitespace adjustments in Verify helper. |
| tests/Shared/Components.Tests.Shared.csproj | New shared test helper project referenced by multiple test projects. |
| tests/Integration/Components.IntegrationTests.csproj | Adjusts integration test project references (Charts reference commented out). |
| tests/Core/Components/Wizard/FluentWizardAdvancedTests.razor | Adds additional wizard tests covering validation/navigation edge cases. |
| tests/Core/Components/Dialog/Overlay/OverlayServiceTests.razor | Adds coverage for Overlay hide error/availability paths. |
| tests/Core/Components/Dialog/Overlay/OverlayServiceDisabledTests.razor | Adds tests for behavior when the global overlay feature is disabled. |
| tests/Core/Components/Dialog/DialogServiceInternalTests.cs | Adds internal DialogService removal-path test coverage. |
| tests/Core/Components/DataGrid/FluentDataGridTests.razor | Adds tests for column reorder option buttons invoking move handlers. |
| tests/Core/Components/Base/FluentInputBaseTests.razor | Adds base input component parameter/default behavior tests. |
| tests/Core/Components.Tests.csproj | References the new shared test helper project. |
| tests/Core/_StartCodeCoverage.cmd | Removes the old Core-only coverage helper script. |
| tests/Charts/xunit.runner.json | Adds Charts xUnit runner configuration (disables parallelization). |
| tests/Charts/Models/TooltipContextTests.cs | Adds unit tests for TooltipContext model behavior. |
| tests/Charts/Models/FunnelSubValueTests.cs | Adds unit tests for FunnelSubValue defaults, serialization, and equality. |
| tests/Charts/Models/ChartAxisValueTests.cs | Adds unit tests for ChartAxisValue conversions/equality/hash code behavior. |
| tests/Charts/Models/ChartAxisValueJsonConverterTests.cs | Adds unit tests for ChartAxisValue JSON converter behavior. |
| tests/Charts/Models/CalloutAccessibilityDataTests.cs | Adds unit tests for CalloutAccessibilityData JSON names and equality. |
| tests/Charts/Extensions/DataVizPaletteExtensionsTests.cs | Adds unit tests for DataVizPalette token/hex conversion helpers. |
| tests/Charts/Components.Charts.Tests.csproj | Adds a dedicated Charts test project. |
| tests/Charts/Charts/HorizontalBarChartWithAxis/FluentHorizontalBarChartWithAxisTests.razor | Adds component tests for FluentHorizontalBarChartWithAxis parameters/behavior. |
| tests/Charts/Charts/HorizontalBarChartWithAxis/FluentHorizontalBarChartWithAxisTests.FluentHorizontalBarChartWithAxis_Default.verified.razor.html | Adds Verify snapshot for default FluentHorizontalBarChartWithAxis render. |
| tests/Charts/Charts/HorizontalBarChart/FluentHorizontalBarChartTests.razor | Adds component tests for FluentHorizontalBarChart parameters/behavior. |
| tests/Charts/Charts/HorizontalBarChart/FluentHorizontalBarChartTests.FluentHorizontalBarChart_Default.verified.razor.html | Adds Verify snapshot for default FluentHorizontalBarChart render. |
| tests/Charts/Charts/GanttChart/FluentGanttChartTests.razor | Adds component tests for FluentGanttChart parameters and tick serialization behavior. |
| tests/Charts/Charts/GanttChart/FluentGanttChartTests.FluentGanttChart_Default.verified.razor.html | Adds Verify snapshot for default FluentGanttChart render. |
| tests/Charts/Charts/FunnelChart/FluentFunnelChartTests.razor | Adds component tests for FluentFunnelChart parameters/behavior. |
| tests/Charts/Charts/FunnelChart/FluentFunnelChartTests.FluentFunnelChart_Default.verified.razor.html | Adds Verify snapshot for default FluentFunnelChart render. |
| tests/Charts/Charts/FluentChartBaseTests.razor | Adds tests for tooltip context building, JS bridge lifecycle, and disposal paths. |
| tests/Charts/Charts/DonutChart/FluentDonutChartTests.razor | Adds component tests for FluentDonutChart parameters/behavior. |
| tests/Charts/Charts/DonutChart/FluentDonutChartTests.FluentDonutChart_Default.verified.razor.html | Adds Verify snapshot for default FluentDonutChart render. |
| tests/Charts/_UpdateVerifiedFiles.cmd | Adds helper script to update verified files via env var. |
| tests/Charts/_Imports.razor | Adds shared imports for Charts test project Razor tests. |
| tests/_StartCodeCoverage.cmd | Adds a consolidated Core+Charts coverage helper script with change detection/stamps. |
| src/Charts/Serialization/HorizontalBarChartWithAxisDataJsonSerializerContext.cs | Excludes source-generated serializer context from code coverage. |
| src/Charts/Serialization/HorizontalBarChartDataJsonSerializerContext.cs | Excludes source-generated serializer context from code coverage. |
| src/Charts/Serialization/GanttChartDataJsonSerializerContext.cs | Excludes source-generated serializer context from code coverage. |
| src/Charts/Serialization/FunnelChartDataJsonSerializerContext.cs | Excludes source-generated serializer context from code coverage. |
| src/Charts/Serialization/DonutChartDataJsonSerializerContext.cs | Excludes source-generated serializer context from code coverage. |
| src/Charts/Serialization/DataVizPaletteJsonConverter.cs | Excludes palette JSON converter from code coverage. |
| src/Charts/Models/HorizontalBarChartWithAxis/HorizontalBarChartWithAxisSeries.cs | Removes an existing Charts model type. |
| src/Charts/Infrastructure/ChartJson.cs | Excludes ChartJson helper from code coverage. |
| src/Charts/Charts/FluentCartesianChartBase.cs | Excludes internal source-generated JSON context from code coverage. |
| Microsoft.FluentUI-v5.slnx | Adds the new test projects to the solution. |
…m/microsoft/fluentui-blazor into users/vnbaaij/dev-v5/charts-tests
- Use correct TFM for test projects
- Update pipelines (GH and AzDO)
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.
Chart tests have been added. Coverage now at 100%
Source-generated classes have been excluded from coverage.

_StartCodeCoveragewas moved to tests folder (1 up) and logicwas added to only run against changed test projects (and include option to force run)