Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

radical
Copy link
Member

@radical radical commented Jul 10, 2025

Reduces CI time from ~24mins to ~15mins.

[tests] Split NewUpAndBuildSupportProjectTemplates

The number of tests have multiplied in this class, and it takes ~14 mins on github
actions to run them. Split them up so they can run in parallel and the
overall run time can come down.

The number of tests have multiplied, and it takes ~14 mins on github
actions to run them. Split them up so they can run in parallel and the
overall run time can come down.
@Copilot Copilot AI review requested due to automatic review settings July 10, 2025 07:57
@radical radical requested a review from eerhardt as a code owner July 10, 2025 07:57
@github-actions github-actions bot added the area-engineering-systems infrastructure helix infra engineering repo stuff label Jul 10, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

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 refactors the NewUpAndBuildSupportProjectTemplatesTests class by extracting a shared protected method into an abstract base class and splitting the various template configurations into separate derived test classes so they can run in parallel.

  • Introduces NewUpAndBuildSupportProjectTemplatesBase (abstract) with CanNewAndBuildActual
  • Creates one derived test class per template variant (NUnit, XUnit v2/v3/v3MTP, MSTest, etc.)
  • Removes the monolithic [Theory] with many MemberData entries and spreads them across multiple classes
Comments suppressed due to low confidence (4)

tests/Aspire.Templates.Tests/NewUpAndBuildSupportProjectTemplatesTests.cs:8

  • [nitpick] The base class name ends with Base but doesn’t clearly signal it’s for tests. Consider renaming to NewUpAndBuildSupportProjectTemplatesTestsBase for consistency with test naming conventions.
public abstract class NewUpAndBuildSupportProjectTemplatesBase(ITestOutputHelper testOutput) : TemplateTestsBase(testOutput)

tests/Aspire.Templates.Tests/NewUpAndBuildSupportProjectTemplatesTests.cs:64

  • [nitpick] Type names with underscores diverge from .NET PascalCase conventions. Rename NUnit_NewUpAndBuildSupportProjectTemplatesTests to something like NUnitNewUpAndBuildSupportProjectTemplatesTests.
public class NUnit_NewUpAndBuildSupportProjectTemplatesTests : NewUpAndBuildSupportProjectTemplatesBase

tests/Aspire.Templates.Tests/NewUpAndBuildSupportProjectTemplatesTests.cs:64

  • [nitpick] There is significant duplication across the multiple derived test classes differing only by their MemberData argument. Consider parameterizing these variants (e.g., via a single [Theory] with combined MemberData or code generation) to reduce boilerplate.
public class NUnit_NewUpAndBuildSupportProjectTemplatesTests : NewUpAndBuildSupportProjectTemplatesBase

tests/Aspire.Templates.Tests/NewUpAndBuildSupportProjectTemplatesTests.cs:71

  • Attribute parameters must be compile-time constants; verify that the C# collection-expression syntax (["aspire-nunit", ""]) is valid here. If not, switch to an explicit new object[]{ ... } initializer.
    [MemberData(nameof(TestDataForNewAndBuildTemplateTests), arguments: ["aspire-nunit", ""])]

@radical radical enabled auto-merge (squash) July 10, 2025 19:00
@radical radical merged commit 6a73c7b into dotnet:main Jul 10, 2025
272 of 273 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Aug 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-engineering-systems infrastructure helix infra engineering repo stuff
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants