Skip to content

Build & run tests for test templates via a pipeline to support CG #49147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 28, 2025

Conversation

mariam-abdulla
Copy link
Member

@mariam-abdulla mariam-abdulla commented May 26, 2025

This pull request introduces a new PowerShell script to run test template tests in the dogfood environment and integrates it into the SDK build pipeline. The key changes include the addition of the script and its execution step in the pipeline configuration.

Additions to test execution:

  • build/RunTestTemplateTests.ps1: Added a new PowerShell script to run the Microsoft.TestTemplates.Acceptance.Tests.dll in the dogfood environment. The script includes functionality to locate the test DLL, verify its existence, and execute it using the dogfood.ps1 script. It also handles error reporting and exit codes.

Pipeline integration:

  • eng/pipelines/templates/jobs/sdk-build.yml: Integrated the new RunTestTemplateTests.ps1 script into the SDK build pipeline by adding a PowerShell step to execute the script. This step is labeled "🟣 Run Test Templates Tests" in the pipeline.

@Copilot Copilot AI review requested due to automatic review settings May 26, 2025 13:42
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 introduces automated execution of test-template integration tests by extending the SDK build pipeline.

  • Adds a new pipeline step to invoke a PowerShell script for test-template tests
  • Provides RunTestTemplateTests.ps1 to run the dotnet-new integration tests in the dogfood environment

Reviewed Changes

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

File Description
eng/pipelines/templates/jobs/sdk-build.yml Inserts a powershell step to run RunTestTemplateTests.ps1
build/RunTestTemplateTests.ps1 Adds a script that locates and runs the dotnet-new integration tests
Comments suppressed due to low confidence (2)

build/RunTestTemplateTests.ps1:15

  • [nitpick] Consider renaming $classNameFilter to something like $filterOption or $filterArg to better reflect that it's the dotnet test filter flag, not specifically a class-name filter.
$classNameFilter = "--filter"

@mariam-abdulla mariam-abdulla enabled auto-merge (squash) May 28, 2025 08:12
@mariam-abdulla mariam-abdulla changed the title Build tests for test templates via a pipeline to support CG Build & run tests for test templates via a pipeline to support CG May 28, 2025
Copy link
Member

@Evangelink Evangelink left a comment

Choose a reason for hiding this comment

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

LGTM. I am wondering if there is some preference on SDK repo to start using cs files now that we can do dotnet run <file>.cs

@@ -4,7 +4,6 @@ VisualStudioVersion = 17.1.31903.286
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{50A89C27-BA35-44B2-AC57-E54551791C64}"
ProjectSection(SolutionItems) = preProject
eng\cgmanifest.json = eng\cgmanifest.json
Copy link
Member

Choose a reason for hiding this comment

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

Was it requested to drop the manifest?

Copy link
Member Author

Choose a reason for hiding this comment

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

Building and running those test projects is the other way to report our used packages to CG.

$ErrorActionPreference = 'Stop'
$RepoRoot = Resolve-Path (Join-Path $PSScriptRoot '..')
$classNameFilter = "--filter"
$filterValue = "FullyQualifiedName~Microsoft.DotNet.Cli.New.IntegrationTests.DotnetNewTestTemplatesTests"
Copy link
Member

Choose a reason for hiding this comment

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

Mixing tabs and spaces

@mariam-abdulla mariam-abdulla merged commit 2310f2b into main May 28, 2025
30 checks passed
@mariam-abdulla mariam-abdulla deleted the dev/mabdullah/test-templates-cg branch May 28, 2025 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants