Skip to content

test: rearrange unit tests to one test file per component - #282

Merged
kdinev merged 3 commits into
masterfrom
dpetev/unit-tests-rearrange
Jul 30, 2026
Merged

test: rearrange unit tests to one test file per component#282
kdinev merged 3 commits into
masterfrom
dpetev/unit-tests-rearrange

Conversation

@damyanpetev

Copy link
Copy Markdown
Member

Breaks up the catch-all files in tests/IgniteUI.Blazor.Tests so every component has its own suite file. All three TFMs green: 881 passed, 22 skipped, 903 total on net8.0 / net9.0 / net10.0.

What changed

Split grab-bag files into per-component files (12 deleted → 12 created):

Deleted Now lives in
MiscComponentTests.cs AccordionTests.cs, BannerTests.cs, DividerTests.cs, RippleTests.cs
NavigationTests.cs NavbarTests.cs, NavDrawerTests.cs
AlertTests.cs SnackbarTests.cs, ToastTests.cs
ProgressTests.cs LinearProgressTests.cs, CircularProgressTests.cs
TextInputTests.cs TextareaTests.cs, MaskInputTests.cs
7 × *ExtendedTests.cs (Badge, Dialog, Dropdown, Input, Progress, Select, Slider) dissolved into each component's own file

The *Extended* files were the same problem under a different name — BadgeExtendedTests actually held Badge + Avatar + Chip + Icon + Ripple + Divider facts, ProgressExtendedTests held Progress + Rating + List + Tabs + Card. Each fact moved to its component's suite, merged into the existing class rather than a second class, so a component now has one suite with its contract runners and plain bUnit facts side by side.

Child-component suites live in their parent's file: new SelectGroupTests / SelectHeaderTests, DropdownGroupTests / DropdownHeaderTests, SliderLabelTests, RatingSymbolTests, NavDrawerItemTests / NavDrawerHeaderItemTests. Cross-cutting suites (BaseControlTests, *SerializationTests, ScriptPropTests, Interop*Tests) are keyed to a behavior rather than a component and keep their own files.

Two things worth a reviewer's attention:

  • 39 test methods dropped as exact duplicates. The Extended files had drifted into re-asserting what the primary suites already covered — e.g. Snackbar_ActionText_RendersAttribute existed verbatim in both AlertTests and DialogExtendedTests; same for Toast display-time/keep-open, Slider bounds, Textarea label/readonly, and the Divider/Ripple render checks. Only facts where property, value, and assertion were identical were removed; [InlineData] count is unchanged at 135, and 761 − 722 = 39 matches the dedup list exactly.
  • ElementAssertionExtensions (Should_Exist) was hidden at the bottom of ButtonTests.cs — moved to its own ElementAssertionExtensions.cs.

Docs

  • skills/igniteui-blazor-lite-testing/SKILL.md — the old convention told you to expect this ("Suites may live per class, instead of per file — BannerTests is in MiscComponentTests.cs"). Replaced with the one-file-per-component rule, the child-component exception, and the no-second-suite rule.
  • skills/igniteui-blazor-lite-testing/references/interop-contracts.md — same stale pointer ("search for the class, not the file", XTests + XExtendedTests) rewritten.
  • .github/CONTRIBUTING.md — added the layout convention under the TDD bullet in New feature development; it had no guidance on where tests go.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reorganizes the IgniteUI.Blazor.Tests unit-test suite to follow a clearer one-file-per-component layout, dissolving prior “grab-bag” and *ExtendedTests.cs files while keeping coverage intact (and removing exact duplicate facts). It also updates the shipped testing guidance/docs to match the new convention and extracts a shared assertion helper into its own file.

Changes:

  • Split mixed/extended test files into per-component suites and moved child-component suites into their parent component’s test file where appropriate.
  • Removed exact duplicate tests while keeping the net set of unique assertions.
  • Moved ElementAssertionExtensions into a dedicated ElementAssertionExtensions.cs helper file and updated docs/contributing guidance for the new layout.

Reviewed changes

Copilot reviewed 39 out of 39 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/IgniteUI.Blazor.Tests/ToastTests.cs New per-component suite for IgbToast (moved from shared file).
tests/IgniteUI.Blazor.Tests/TextareaTests.cs Kept Textarea suite focused on IgbTextarea; moved MaskInput out.
tests/IgniteUI.Blazor.Tests/TabsTests.cs Added/moved Tabs child-content rendering fact into the Tabs suite.
tests/IgniteUI.Blazor.Tests/SwitchTests.cs Added/moved Required/Invalid attribute facts into Switch suite.
tests/IgniteUI.Blazor.Tests/SnackbarTests.cs Removed embedded ToastTests class now that ToastTests.cs exists.
tests/IgniteUI.Blazor.Tests/SliderTests.cs Merged former extended slider facts; added SliderLabelTests child suite.
tests/IgniteUI.Blazor.Tests/SliderExtendedTests.cs Deleted (tests moved into SliderTests.cs / other suites).
tests/IgniteUI.Blazor.Tests/SelectTests.cs Merged former extended select facts; added SelectGroupTests/SelectHeaderTests child suites.
tests/IgniteUI.Blazor.Tests/SelectExtendedTests.cs Deleted (tests moved into SelectTests.cs).
tests/IgniteUI.Blazor.Tests/RippleTests.cs New per-component suite for IgbRipple.
tests/IgniteUI.Blazor.Tests/RatingTests.cs Added/moved RatingSymbolTests child suite and rating child-content fact.
tests/IgniteUI.Blazor.Tests/ProgressExtendedTests.cs Deleted (tests moved into the specific component suites like LinearProgressTests, TabsTests, etc.).
tests/IgniteUI.Blazor.Tests/NavigationTests.cs Deleted (split into NavbarTests.cs and NavDrawerTests.cs).
tests/IgniteUI.Blazor.Tests/NavDrawerTests.cs Promoted to main NavDrawerTests with interop contract; kept child item/header-item suites in-file.
tests/IgniteUI.Blazor.Tests/NavbarTests.cs New per-component suite for IgbNavbar.
tests/IgniteUI.Blazor.Tests/MaskInputTests.cs New per-component suite for IgbMaskInput including interop contract runners.
tests/IgniteUI.Blazor.Tests/ListTests.cs Added/moved ListHeader child-content fact into List suite.
tests/IgniteUI.Blazor.Tests/LinearProgressTests.cs Removed embedded CircularProgress suite; added/moved AnimationDuration fact.
tests/IgniteUI.Blazor.Tests/InputTests.cs Merged former extended input facts into InputTests.
tests/IgniteUI.Blazor.Tests/InputExtendedTests.cs Deleted (tests moved into InputTests.cs / other suites).
tests/IgniteUI.Blazor.Tests/IconTests.cs Added/moved Icon child-content fact into IconTests.
tests/IgniteUI.Blazor.Tests/ElementAssertionExtensions.cs New shared helper file for Should_Exist.
tests/IgniteUI.Blazor.Tests/DropdownTests.cs Merged former extended dropdown facts; added DropdownGroupTests/DropdownHeaderTests child suites.
tests/IgniteUI.Blazor.Tests/DropdownExtendedTests.cs Deleted (tests moved into DropdownTests.cs).
tests/IgniteUI.Blazor.Tests/DividerTests.cs New per-component suite for IgbDivider.
tests/IgniteUI.Blazor.Tests/DialogExtendedTests.cs Deleted (tests moved into the appropriate component suites).
tests/IgniteUI.Blazor.Tests/CircularProgressTests.cs New per-component suite for IgbCircularProgress (split from LinearProgressTests.cs).
tests/IgniteUI.Blazor.Tests/ChipTests.cs Added/moved additional StyleVariant facts into ChipTests.
tests/IgniteUI.Blazor.Tests/CheckboxTests.cs Added/moved Invalid attribute fact into CheckboxTests.
tests/IgniteUI.Blazor.Tests/CardTests.cs Added/moved child-content facts for Card* subcomponents into CardTests.cs.
tests/IgniteUI.Blazor.Tests/ButtonTests.cs Removed embedded ElementAssertionExtensions (now in its own file).
tests/IgniteUI.Blazor.Tests/BannerTests.cs New per-component suite for IgbBanner with interop contract runners.
tests/IgniteUI.Blazor.Tests/BadgeTests.cs Added/moved StyleVariant and child-content facts into BadgeTests.
tests/IgniteUI.Blazor.Tests/BadgeExtendedTests.cs Deleted (tests moved into component suites).
tests/IgniteUI.Blazor.Tests/AvatarTests.cs Added/moved Shape_Square and child-content facts into AvatarTests.
tests/IgniteUI.Blazor.Tests/AccordionTests.cs Removed embedded unrelated suites; kept only accordion assertions in file.
skills/igniteui-blazor-lite-testing/SKILL.md Updated guidance to reflect one-file-per-component convention and helper location.
skills/igniteui-blazor-lite-testing/references/interop-contracts.md Updated contract placement guidance to match new file layout.
.github/CONTRIBUTING.md Added/updated contributor guidance to document the new unit-test layout convention.
Comments suppressed due to low confidence (1)

.github/CONTRIBUTING.md:138

  • Spelling/capitalization: "refenrece of the github task" should be "reference of the GitHub task".
4. `<issue>` - The issue is the refenrece of the github task you have. Be aware that you are able to link more than one issue. For instance `(#123 #456)`.

Comment thread skills/igniteui-blazor-lite-testing/references/interop-contracts.md Outdated
Comment thread .github/CONTRIBUTING.md Outdated
kdinev and others added 2 commits July 30, 2026 10:10
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@kdinev
kdinev enabled auto-merge (squash) July 30, 2026 07:14
@kdinev
kdinev merged commit 17a9f42 into master Jul 30, 2026
7 checks passed
@kdinev
kdinev deleted the dpetev/unit-tests-rearrange branch July 30, 2026 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📖 documentation Improvements or additions to documentation 🧪 ci: tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants