Skip to content

Migrate Get-Package E2E coverage to Apex - #7452

Closed
nkolev92 with Copilot wants to merge 7 commits into
devfrom
copilot/migrate-tests-and-combine-duplicates
Closed

nkolev92 with Copilot wants to merge 7 commits into
devfrom
copilot/migrate-tests-and-combine-duplicates

Conversation

Copilot AI commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

Progress: https://github.com/NuGet/Client.Engineering/issues/2085

This PR advances the Apex migration effort by moving a focused set of Get-Package end-to-end behaviors from PowerShell to C# Apex tests, and adds lower-cost unit-style coverage in the PowerShell host test project for key parsing/view-model behaviors.

  • Migration scope

    • Added Apex coverage for Get-Package path source handling, prerelease filtering, and update resolution behavior.
    • Added Apex coverage for list-available filtering of package identity (ReleaseNotesPackage).
  • Apex scope adjustment

    • Reduced the expensive path-source Apex matrix to a single retained scenario: relativeLeafFromParent.
    • GetPackageFromPMCWithPathSource_ReturnsAvailablePackagesAsync is now a single-scenario test (no longer data-driven across 3 source modes).
  • Cheaper variant coverage (PowerShell host unit tests)

    • Added test/NuGet.Clients.Tests/NuGetConsole.Host.PowerShell.Test/Model/GetPackageViewModelTests.cs.
    • Added unit-style variants validating core Get-Package view-model behavior, including:
      • latest vs all-version display behavior for remote package results
      • update-result shaping for latest-only vs all eligible updates
  • Feedback-driven organization update

    • Moved Get-Package Apex scenarios out of NuGetConsoleTestCase.cs into a dedicated GetPackageTestCase.cs for command-focused colocation and clearer test organization.
    • Left non-Get-Package PMC scenarios in NuGetConsoleTestCase.cs.
    • Updated .copilot/skills/apex-migration/SKILL.md file-placement guidance so future migrations place Get-Package scenarios in GetPackageTestCase.cs.
  • Decision table (migrated/combined)

    PowerShell test removed Apex replacement Decision
    Test-GetPackageAcceptsAbsolutePathSource GetPackageFromPMCWithPathSource_ReturnsAvailablePackagesAsync (single retained relativeLeafFromParent scenario) Migrated (matrix reduced)
    Test-GetPackageAcceptsRelativePathSource GetPackageFromPMCWithPathSource_ReturnsAvailablePackagesAsync (single retained relativeLeafFromParent scenario) Migrated (matrix reduced)
    Test-GetPackageAcceptsRelativePathSource2 GetPackageFromPMCWithPathSource_ReturnsAvailablePackagesAsync (single retained relativeLeafFromParent scenario) Migrated
    Test-ZipPackageLoadsReleaseNotesAttribute GetPackageFromPMCWithListAvailableFilter_FindsReleaseNotesPackageAsync Migrated
    Test-GetPackagesDoesNotShowPrereleasePackagesWhenSwitchIsNotSpecified GetPackageFromPMCWithoutPrereleaseSwitch_HidesPrereleaseVersionsAsync Migrated
    Test-GetPackagesAllVersionsDoesNotShowPrereleasePackagesWhenSwitchIsNotSpecified GetPackageFromPMCWithAllVersionsWithoutPrereleaseSwitch_HidesPrereleaseVersionsAsync Migrated
    Test-GetPackagesWithPrereleaseSwitchShowsPrereleasePackages GetPackageFromPMCWithPrereleaseSwitch_ShowsPrereleaseVersionAsync Migrated
    Test-GetPackagesWithAllAndPrereleaseSwitchShowsAllPackages GetPackageFromPMCWithAllVersionsAndPrereleaseSwitch_ShowsAllVersionsAsync Migrated
    Test-GetPackageUpdatesDoNotReturnPrereleasePackagesIfFlagIsNotSpecified GetPackageUpdatesFromPMCWithoutPrereleaseSwitch_DoesNotReturnPrereleaseUpdateAsync Migrated
    Test-GetPackageUpdatesReturnPrereleasePackagesIfFlagIsSpecified GetPackageUpdatesFromPMCWithPrereleaseSwitch_ReturnsPrereleaseUpdateAsync Migrated
    Test-GetPackageUpdatesReturnAllVersionsIfFlagIsSpecified GetPackageUpdatesFromPMCWithAllVersionsSwitch_ReturnsStableVersionAsync Migrated
    Test-GetPackageUpdatesReturnAllVersionsAndPrereleaseVersionsIfTwoFlagsAreSpecified GetPackageUpdatesFromPMCWithAllVersionsAndPrereleaseSwitch_ReturnsAllEligibleUpdatesAsync Migrated

@nkolev92 nkolev92 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@copilot Explore create a variant of these tests in https://github.com/NuGet/NuGet.Client/tree/dev/test/NuGet.Clients.Tests/NuGetConsole.Host.PowerShell.Test instead.

These APEX tests are long running and expensive, a cheaper version would be to have unit tests.

Leave all the migrated Apex tests for the time being, just try to create a copy of them.

Comment thread .copilot/skills/apex-migration/SKILL.md Resolved

Copilot AI commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Explore create a variant of these tests in https://github.com/NuGet/NuGet.Client/tree/dev/test/NuGet.Clients.Tests/NuGetConsole.Host.PowerShell.Test instead.

These APEX tests are long runni...

Addressed in e79504d. I added a cheaper unit-style variant suite in test/NuGet.Clients.Tests/NuGetConsole.Host.PowerShell.Test/Model/GetPackageViewModelTests.cs that mirrors key migrated Get-Package behaviors in the PowerShell host test project while keeping the Apex coverage in place.

Copilot AI changed the title Migrate Get-Package E2E coverage to Apex and de-duplicate legacy PowerShell tests Migrate Get-Package E2E coverage to Apex and add cheaper PowerShell host unit variants Jun 5, 2026
Copilot AI requested a review from nkolev92 June 5, 2026 01:07
@nkolev92
nkolev92 force-pushed the copilot/migrate-tests-and-combine-duplicates branch from 567a8fa to ed110d8 Compare June 5, 2026 19:25
@nkolev92
nkolev92 marked this pull request as ready for review June 5, 2026 19:26
@nkolev92
nkolev92 requested a review from a team as a code owner June 5, 2026 19:26
@nkolev92
nkolev92 requested a review from jeffkl June 5, 2026 19:26
@nkolev92 nkolev92 changed the title Migrate Get-Package E2E coverage to Apex and add cheaper PowerShell host unit variants Migrate Get-Package E2E coverage to Apex Jun 5, 2026
- Remove duplicate private static GetConsole method in GetPackageTestCase.cs that hid the inherited protected base member (CS0108) and incorrectly used inaccessible GetComponentModelService<T>() (CS0122).

- Remove unused 'using NuGet.Test.Utility;' from GetPackageTestCase.cs (IDE0005).

- Remove unused 'using System.Linq;' from NuGetConsoleTestCase.cs (IDE0005).

Co-authored-by: Copilot <[email protected]>
@nkolev92
nkolev92 marked this pull request as draft June 5, 2026 21:57
@nkolev92

nkolev92 commented Jun 5, 2026

Copy link
Copy Markdown
Member

By steering copilot I was able to get faster integration tests instead. I'll merge that here.

@nkolev92 nkolev92 closed this Jun 5, 2026
@nkolev92
nkolev92 deleted the copilot/migrate-tests-and-combine-duplicates branch June 5, 2026 22:29
nkolev92 added a commit that referenced this pull request Jun 5, 2026
- 16 tests covering ListAvailable, Updates, and Installed scenarios
- Tests invoke GetPackageCommand directly in a PowerShell runspace
- Covers prerelease filtering, version collapsing, project filtering
- Replaces need for expensive Apex E2E tests (PR #7452)

Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants