Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
e427f13
Migrate from VSTest to Microsoft.Testing.Platform
Youssef1313 Apr 2, 2025
d09bcd5
Address TODO
Youssef1313 Apr 2, 2025
58a546a
Cleanup stuff around runsettings
Youssef1313 Apr 3, 2025
3e4ccd1
Add comment
Youssef1313 Apr 3, 2025
f1a32f2
Progress
Youssef1313 Apr 3, 2025
8bd7802
Remove locale
Youssef1313 Apr 3, 2025
c179724
Always show live output
Youssef1313 Apr 3, 2025
d82894a
Restore test session timeout
Youssef1313 Apr 3, 2025
04dfe12
Fix timeout
Youssef1313 Apr 3, 2025
6cd862b
Fix typo
Youssef1313 Apr 3, 2025
3b40316
Fix duplicate commnand-line options
Youssef1313 Apr 3, 2025
f7e6994
Fix Linux
Youssef1313 Apr 3, 2025
45fd316
Fix for Linux
Youssef1313 Apr 3, 2025
e5458d1
Fix
Youssef1313 Apr 3, 2025
519188d
Fix
Youssef1313 Apr 3, 2025
cb6cd28
Filter failing
Youssef1313 Apr 4, 2025
29087a6
Fix
Youssef1313 Apr 4, 2025
5f0f004
ignore exit code 8
Youssef1313 Apr 4, 2025
ce7e735
Fix extra dot
Youssef1313 Apr 4, 2025
e0b800c
Ignore exit code
Youssef1313 Apr 4, 2025
c44896a
Fix duplicate --ignore-exit-code
Youssef1313 Apr 4, 2025
f15a1c1
Fix playground tests on helix
radical Apr 4, 2025
d3795eb
Move to RepoTesting.props
Youssef1313 Apr 5, 2025
e440ddf
Fix results dir
Youssef1313 Apr 5, 2025
f33dc66
Fix
Youssef1313 Apr 5, 2025
688b6d6
Progress
Youssef1313 Apr 5, 2025
a8b0cd6
Fix duplicate command-line option
Youssef1313 Apr 5, 2025
cc26956
Missing report-trx
Youssef1313 Apr 7, 2025
11e89e4
Merge branch 'main' into dev/ygerges/migrate-to-mtp
Apr 7, 2025
5ea5eac
Merge branch 'main' into dev/ygerges/migrate-to-mtp
Youssef1313 Apr 8, 2025
d10e168
Run executable
Youssef1313 Apr 9, 2025
c54564b
Address review comments
Youssef1313 Apr 9, 2025
8f77898
Revert "Run executable"
Youssef1313 Apr 9, 2025
4ba7d9a
dotnet dll
Youssef1313 Apr 9, 2025
5201f07
Introduce version selector for Aspire templates (#8625)
mitchdenny Apr 8, 2025
7817820
Error handling for GetCapabilitiesAsync connection issues (#8614)
mitchdenny Apr 8, 2025
4a3a753
Obsolete AddAzureContainerAppsInfrastructure (#8639)
eerhardt Apr 8, 2025
42735e0
Add error handling for package updates in workflow (#8390)
joperezr Apr 8, 2025
d414db6
Filter out tracing health endpoints in service defaults templates (#8…
DamianEdwards Apr 8, 2025
5f89e7d
Show neutral icon for container exiting with status code 0 (#8477)
adamint Apr 8, 2025
ec6cacb
[tests] Correctly mark Aspire.Dashboard.Tests.Integration.Playwright.…
radical Apr 8, 2025
5958a02
[tests] Skip generating Directory.Packages.Versions.props for Test (#…
radical Apr 8, 2025
ddf0755
Fix running playground tests on windows
radical Apr 9, 2025
8e5e3db
Merge branch 'main' into dev/ygerges/migrate-to-mtp
Youssef1313 Apr 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 16 additions & 22 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,18 +220,13 @@ jobs:
TEST_LOG_PATH: ${{ github.workspace }}/artifacts/log/test-logs
TestsRunningOutsideOfRepo: true
run: >
dotnet test -s .runsettings -v:n ${{ env.TEST_ASSEMBLY_NAME }}.dll
-l "console;verbosity=normal"
-l "trx;LogFilePrefix=${{ inputs.testShortName }}"
-l "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true"
--blame
--blame-hang-timeout ${{ inputs.testHangTimeout }}
--blame-crash
dotnet exec ${{ env.TEST_ASSEMBLY_NAME }}.dll

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.

Is this really how normal developers are supposed to execute tests using the Microsoft.Testing.Platform? In general, we don't suggest to people to use dotnet exec. You can dotnet XXX.dll or just run the platform-specific executable ${{ env.TEST_ASSEMBLY_NAME }}[.exe]

@Youssef1313 Youssef Fahmy (Youssef1313) Apr 7, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

All the three approaches will work (dotnet exec dll, dotnet dll, or the executable directly). If you have preference let me know and I can refactor.

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.

What's the preference from the test team?

I guess I would prefer invoking the executable directly.

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.

I'm reworking the infra with expectation that we'd be running build.cmd/sh for all build, test, package, etc. needs.

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.

That's not a correct expectation, as for nuget testing, and tests run on helix we run just the binaries, and thus no arcade or repository is available.

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.

We won't be running on Helix at all.

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.

We are using dotnet exec because the tests are being run without the project file available. But since the test assembly is executable now, we can directly run that.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I tried to move over to running executable directly, but it's not in the zip file when using ZipTestArchive. I have no idea why. Maybe we are zipping too early or something. I'm doing dotnet test.dll for now. We can follow-up with investigation to include the exe in the zip.

'@.runsettings'
--report-trx --report-trx-filename "${{ inputs.testShortName }}.trx"
--hangdump --hangdump-timeout ${{ inputs.testHangTimeout }}
--crashdump
--results-directory ${{ github.workspace }}/testresults
${{ inputs.extraTestArgs }}
--
RunConfiguration.CollectSourceInformation=true
RunConfiguration.TestSessionTimeout=${{ inputs.testSessionTimeoutMs }}

- name: Run tests
if: ${{ ! inputs.requiresNugets }}
Expand All @@ -240,24 +235,23 @@ jobs:
CI: false
DCP_DIAGNOSTICS_LOG_LEVEL: debug
DCP_DIAGNOSTICS_LOG_FOLDER: ${{ github.workspace }}/testresults/dcp
# During restore and build, we use -ci, which causes NUGET_PACKAGES to point to a local cache (Arcade behavior).
# In this step, we are not using Arcade, but want to make sure that MSBuild is able to evaluate correctly.
# So, we manually set NUGET_PACKAGES
NUGET_PACKAGES: ${{ github.workspace }}/.packages

Comment thread
Youssef1313 marked this conversation as resolved.
Outdated
run: >
${{ env.DOTNET_SCRIPT }} test ${{ env.TEST_PROJECT_PATH }}

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.

Why is this one still dotnet test?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm not intending to do any broader refactorings with this PR. This was dotnet test, so I'm keeping as is. We can have a separate build step and then run the executable, but I'm trying to not change much as part of this PR.

/p:ContinuousIntegrationBuild=true
-s eng/testing/.runsettings
-l "console;verbosity=normal"
-l "trx;LogFilePrefix=${{ inputs.testShortName }}"
-l "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true"
"--blame"
--blame-hang-timeout ${{ inputs.testHangTimeout }}
--blame-crash
--results-directory testresults
-bl:${{ github.workspace }}/testresults/test.binlog
--no-restore
--no-build
-bl:${{ github.workspace }}/testresults/test.binlog
${{ inputs.extraTestArgs }}
--
RunConfiguration.CollectSourceInformation=true
RunConfiguration.TestSessionTimeout=${{ inputs.testSessionTimeoutMs }}
--report-trx --report-trx-filename "${{ inputs.testShortName }}.trx"
Comment thread
danmoseley marked this conversation as resolved.
Outdated
--hangdump --hangdump-timeout ${{ inputs.testHangTimeout }}
--crashdump
--results-directory testresults
${{ inputs.extraTestArgs }}

# Save the result of the previous steps - success or failure
# in the form of a file result-success/result-failure -{name}.rst
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
with:
testShortName: ${{ matrix.shortname }}
os: "ubuntu-latest"
extraTestArgs: "--filter \"(quarantined!=true)\""
extraTestArgs: "--filter-not-trait \"quarantined=true\""

integrations_test_win:
uses: ./.github/workflows/run-tests.yml
Expand All @@ -87,7 +87,7 @@ jobs:
with:
testShortName: ${{ matrix.shortname }}
os: "windows-latest"
extraTestArgs: "--filter \"(quarantined!=true)\""
extraTestArgs: "--filter-not-trait \"quarantined=true\""

templates_test_lin:
name: Templates Linux
Expand All @@ -102,8 +102,7 @@ jobs:
testProjectPath: tests/Aspire.Templates.Tests/Aspire.Templates.Tests.csproj
testSessionTimeoutMs: 1200000
testHangTimeout: 12m
# append '.' to the name so only the test class with exactly that name is run
extraTestArgs: "--filter \"(quarantined!=true)&(FullyQualifiedName~Aspire.Templates.Tests.${{ matrix.shortname }}.)\""
extraTestArgs: "--filter-not-trait quarantined=true --filter-class Aspire.Templates.Tests.${{ matrix.shortname }}"
Comment thread
danmoseley marked this conversation as resolved.
requiresNugets: true
requiresTestSdk: true

Expand All @@ -120,8 +119,7 @@ jobs:
testProjectPath: tests/Aspire.Templates.Tests/Aspire.Templates.Tests.csproj
testSessionTimeoutMs: 1200000
testHangTimeout: 12m
# append '.' to the name so only the test class with exactly that name is run
extraTestArgs: "--filter \"(quarantined!=true)&(FullyQualifiedName~Aspire.Templates.Tests.${{ matrix.shortname }}.)\""
extraTestArgs: "--filter-not-trait quarantined=true --filter-class Aspire.Templates.Tests.${{ matrix.shortname }}"
requiresNugets: true
requiresTestSdk: true

Expand Down
4 changes: 3 additions & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
<AzureProvisiongVersion>1.0.0</AzureProvisiongVersion>
<!-- The Npgsql version used when using Npgsql EF Core on net8. The major versions need to match between Npgsql and EF Core. -->
<Npgsql8Version>8.0.6</Npgsql8Version>
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
<TestingPlatformCaptureOutput>false</TestingPlatformCaptureOutput>
</PropertyGroup>
<ItemGroup>
<!-- Azure SDK for .NET dependencies -->
Expand Down Expand Up @@ -144,7 +147,6 @@
<PackageVersion Include="Testcontainers.Oracle" Version="$(TestcontainersPackageVersion)" />
<PackageVersion Include="Testcontainers.Elasticsearch" Version="$(TestcontainersPackageVersion)" />
<PackageVersion Include="Testcontainers" Version="$(TestcontainersPackageVersion)" />
<PackageVersion Include="GitHubActionsTestLogger" Version="2.4.1" />
Comment thread
RussKie marked this conversation as resolved.
Outdated
<!-- playground apps dependencies -->
<PackageVersion Include="Microsoft.Orleans.Clustering.AzureStorage" Version="9.1.2" />
<PackageVersion Include="Microsoft.Orleans.Persistence.AzureStorage" Version="9.1.2" />
Expand Down
33 changes: 0 additions & 33 deletions eng/.runsettings

This file was deleted.

13 changes: 4 additions & 9 deletions eng/Testing.props
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
<Project>
<PropertyGroup Condition="'$(UseVSTestRunner)' != 'true'">
<_QuarantinedTestRunAdditionalArgs>-trait "quarantined=true"</_QuarantinedTestRunAdditionalArgs>
<_NonQuarantinedTestRunAdditionalArgs>-notrait "quarantined=true"</_NonQuarantinedTestRunAdditionalArgs>
</PropertyGroup>

<PropertyGroup Condition="'$(UseVSTestRunner)' == 'true'">
<_QuarantinedTestRunAdditionalArgs>--filter "quarantined=true"</_QuarantinedTestRunAdditionalArgs>
<_NonQuarantinedTestRunAdditionalArgs>--filter "quarantined!=true"</_NonQuarantinedTestRunAdditionalArgs>
<PropertyGroup>
<_QuarantinedTestRunAdditionalArgs>--filter-trait "quarantined=true"</_QuarantinedTestRunAdditionalArgs>
<_NonQuarantinedTestRunAdditionalArgs>--filter-not-trait "quarantined=true"</_NonQuarantinedTestRunAdditionalArgs>
</PropertyGroup>

<PropertyGroup>
<BlameHangTimeout Condition="'$(BlameHangTimeout)' == ''">10m</BlameHangTimeout>
Comment thread
danmoseley marked this conversation as resolved.
<_BlameArgs>--blame --blame-hang-timeout $(BlameHangTimeout) --blame-crash</_BlameArgs>
<_BlameArgs>--hangdump --hangdump-timeout $(BlameHangTimeout) --crash-dump</_BlameArgs>

<TestRunnerAdditionalArguments Condition="'$(RunQuarantinedTests)' == ''">$(TestRunnerAdditionalArguments) $(_NonQuarantinedTestRunAdditionalArgs) $(TestRunnerAdditionalArguments) $(_BlameArgs)</TestRunnerAdditionalArguments>
<TestRunnerAdditionalArguments Condition="'$(RunQuarantinedTests)' == 'true'">$(TestRunnerAdditionalArguments) $(_QuarantinedTestRunAdditionalArgs) $(TestRunnerAdditionalArguments) $(_BlameArgs)</TestRunnerAdditionalArguments>
Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
<DotNetRuntimePreviousVersionForTesting>8.0.13</DotNetRuntimePreviousVersionForTesting>
<!-- dotnet 8.0 versions for running tests - used for templates tests -->
<DotNetSdkPreviousVersionForTesting>8.0.406</DotNetSdkPreviousVersionForTesting>
<UseVSTestRunner>true</UseVSTestRunner>
<XunitV3Version>2.0.0</XunitV3Version>
<XUnitAnalyzersVersion>1.20.0</XUnitAnalyzersVersion>
<XunitRunnerVisualStudioVersion>3.0.2</XunitRunnerVisualStudioVersion>
<MicrosoftTestingPlatformVersion>1.6.3</MicrosoftTestingPlatformVersion>
<!-- Enable to remove prerelease label. -->
<StabilizePackageVersion Condition="'$(StabilizePackageVersion)' == ''">false</StabilizePackageVersion>
<DotNetFinalVersionKind Condition="'$(StabilizePackageVersion)' == 'true'">release</DotNetFinalVersionKind>
Expand Down
91 changes: 91 additions & 0 deletions eng/Xunit3/Microsoft.Testing.Platform.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
Comment thread
danmoseley marked this conversation as resolved.
<Project>

<Target Name="RunTests"
Outputs="%(TestToRun.ResultsStdOutPath)"
Condition="'@(TestToRun)' != ''">
<Telemetry EventName="NETCORE_ENGINEERING_TELEMETRY" EventData="Category=Test" />

<PropertyGroup>
<_TestResultDirectory>$([System.IO.Path]::GetDirectoryName('%(TestToRun.ResultsTrxPath)'))</_TestResultDirectory>
<_TestResultTrxFileName>$([System.IO.Path]::GetFileName('%(TestToRun.ResultsTrxPath)'))</_TestResultTrxFileName>
<_TestResultXmlFileName>$([System.IO.Path]::GetFileName('%(TestToRun.ResultsXmlFileName)'))</_TestResultXmlFileName>
<_TestResultHtmlFileName>$([System.IO.Path]::GetFileName('%(TestToRun.ResultsHtmlFileName)'))</_TestResultHtmlFileName>
</PropertyGroup>

<PropertyGroup>
<_TestEnvironment>%(TestToRun.EnvironmentDisplay)</_TestEnvironment>
<_TestAssembly>%(TestToRun.Identity)</_TestAssembly>
<_TestAssembly>$([System.IO.Path]::ChangeExtension($(_TestAssembly), '.exe'))</_TestAssembly>
<_TestRuntime>%(TestToRun.TestRuntime)</_TestRuntime>
<_TestTimeout>%(TestToRun.TestTimeout)</_TestTimeout>
Comment thread
radical marked this conversation as resolved.
<_TestRunnerAdditionalArguments>%(TestToRun.TestRunnerAdditionalArguments)</_TestRunnerAdditionalArguments>

<_TestRunner>$(_TestAssembly)</_TestRunner>
<_TestRunnerArgs>$(_TestRunnerAdditionalArguments) --results-directory "$(_TestResultDirectory)" --report-xunit --report-xunit-filename "$(_TestResultXmlFileName)" --report-xunit-html --report-xunit-html-filename "$(_TestResultHtmlFileName)"</_TestRunnerArgs>
</PropertyGroup>

<PropertyGroup Condition="'$(_TestRuntime)' == 'Core'">
<_TestRunnerArgs>$(_TestRunnerArgs) --auto-reporters off</_TestRunnerArgs>
</PropertyGroup>

<PropertyGroup>
<_TestRunnerCommand>"$(_TestRunner)" $(_TestRunnerArgs)</_TestRunnerCommand>

<!--
Redirect std output of the runner.
Note that xUnit outputs failure info to both STDOUT (stack trace, message) and STDERR (failed test name)
-->
<_TestRunnerCommand Condition="'$(TestCaptureOutput)' != 'false'">$(_TestRunnerCommand) > "%(TestToRun.ResultsStdOutPath)" 2>&amp;1</_TestRunnerCommand>
</PropertyGroup>

<ItemGroup>
<_OutputFiles Include="%(TestToRun.ResultsXmlPath)" />
<_OutputFiles Include="%(TestToRun.ResultsHtmlPath)" />
<_OutputFiles Include="%(TestToRun.ResultsStdOutPath)" />
</ItemGroup>

<MakeDir Directories="@(_OutputFiles->'%(RootDir)%(Directory)')"/>
<Delete Files="@(_OutputFiles)" />

<Message Text="Running tests: $(_TestAssembly) [$(_TestEnvironment)]" Importance="high"/>
<Exec Command='$(_TestRunnerCommand)'
LogStandardErrorAsError="false"
WorkingDirectory="$(_TargetDir)"
IgnoreExitCode="true"
Timeout="$(_TestTimeout)"
EnvironmentVariables="DOTNET_ROOT=$(DotNetRoot);DOTNET_ROOT_X86=$(DotNetRoot)x86"
ContinueOnError="WarnAndContinue">
<Output TaskParameter="ExitCode" PropertyName="_TestErrorCode" />
</Exec>

<!--
Add command line to the log.
-->
<WriteLinesToFile File="%(TestToRun.ResultsStdOutPath)"
Overwrite="false"
Lines=";=== COMMAND LINE ===;$(_TestRunnerCommand)"
Condition="'$(TestCaptureOutput)' != 'false'" />

<!--
Report test status.
-->
<Message Text="Tests succeeded: $(_TestAssembly) [$(_TestEnvironment)]" Condition="'$(_TestErrorCode)' == '0'" Importance="high" />

<PropertyGroup>
<_ResultsFileToDisplay>%(TestToRun.ResultsHtmlPath)</_ResultsFileToDisplay>
<_ResultsFileToDisplay Condition="!Exists('$(_ResultsFileToDisplay)')">%(TestToRun.ResultsStdOutPath)</_ResultsFileToDisplay>
</PropertyGroup>

<!--
Ideally we would set ContinueOnError="ErrorAndContinue" so that when a test fails in multi-targeted test project
we'll still run tests for all target frameworks. ErrorAndContinue doesn't work well on Linux though: https://github.com/Microsoft/msbuild/issues/3961.
-->
<Error Text="Tests failed: $(_ResultsFileToDisplay) [$(_TestEnvironment)]" Condition="'$(_TestErrorCode)' != '0' and '$(_ErrorOnTestFailure)' != 'false'" File="XUnit" />

<ItemGroup>
<FileWrites Include="@(_OutputFiles)"/>
</ItemGroup>
</Target>

</Project>
16 changes: 12 additions & 4 deletions eng/Xunit3/Xunit3.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,23 @@
<PackageVersion Include="xunit.v3.core" Version="$(XunitV3Version)" />
<PackageVersion Include="xunit.analyzers" Version="$(XunitAnalyzersVersion)" />
<PackageVersion Include="xunit.v3.assert" Version="$(XunitV3Version)" />
<PackageVersion Include="xunit.runner.visualstudio" Version="$(XunitRunnerVisualStudioVersion)" />
<PackageVersion Include="xunit.v3.runner.console" Version="$(XunitV3Version)" />
<PackageVersion Include="Microsoft.Testing.Platform" Version="$(MicrosoftTestingPlatformVersion)" />
<PackageVersion Include="Microsoft.Testing.Platform.MSBuild" Version="$(MicrosoftTestingPlatformVersion)" />
<PackageVersion Include="Microsoft.Testing.Extensions.HangDump" Version="$(MicrosoftTestingPlatformVersion)" />
<PackageVersion Include="Microsoft.Testing.Extensions.CrashDump" Version="$(MicrosoftTestingPlatformVersion)" />
<PackageVersion Include="Microsoft.Testing.Extensions.TrxReport" Version="$(MicrosoftTestingPlatformVersion)" />

<PackageReference Include="xunit.v3" />
<PackageReference Include="xunit.v3.core" />
<PackageReference Include="xunit.analyzers" />
<PackageReference Include="xunit.v3.assert" />
<PackageReference Include="xunit.runner.visualstudio" />
<PackageReference Include="Microsoft.Testing.Platform" />
<PackageReference Include="Microsoft.Testing.Platform.MSBuild" />
<PackageReference Include="Microsoft.Testing.Extensions.HangDump" />
<PackageReference Include="Microsoft.Testing.Extensions.CrashDump" />
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" />
</ItemGroup>

<Import Project="..\tools\VSTest.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
</Project>
<Import Project="Microsoft.Testing.Platform.targets" />
</Project>
37 changes: 2 additions & 35 deletions eng/testing/.runsettings
Original file line number Diff line number Diff line change
@@ -1,35 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<RunConfiguration>
<!-- Timeout in ms, 20 minutes -->
<TestSessionTimeout>1200000</TestSessionTimeout>
<!-- Filter out failing (wrong framework, platform, runtime or activeissue) tests -->
<TestCaseFilter>category!=failing</TestCaseFilter>
</RunConfiguration>
<LoggerRunSettings>
<Loggers>
<Logger friendlyName="trx">
<Configuration>
<LogFileName>TestResults.trx</LogFileName>
</Configuration>
</Logger>
<Logger friendlyName="console">
<Configuration>
<Verbosity>normal</Verbosity>
</Configuration>
</Logger>
<Logger friendlyName="blame" enabled="True" />
</Loggers>
</LoggerRunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<!-- Enables blame -->
<DataCollector friendlyName="blame" enabled="True">
<Configuration>
<CollectDump DumpType="Full" />
<CollectDumpOnTestSessionHang TestTimeout="7min" HangDumpType="Full" />
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>
# Filter out failing (wrong framework, platform, runtime or activeissue) tests
--filter-not-trait "category=failing"
Comment thread
danmoseley marked this conversation as resolved.
Outdated
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>$(DefaultTargetFramework)</TargetFramework>
<TestingPlatformCommandLineArguments>$(TestingPlatformCommandLineArguments) --ignore-exit-code 8</TestingPlatformCommandLineArguments>
Comment thread
danmoseley marked this conversation as resolved.

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.

Youssef Fahmy (@Youssef1313) this doesn't appear to be used in Microsoft.Testing.Platform.targets, which results in the tests to fail
image

Should this be tucked on to _TestRunnerArgs?
https://github.com/dotnet/aspire/blob/fd413eb66b219013ad4b8bc64a459c84a82fa446/eng/Xunit3/Microsoft.Testing.Platform.targets#L23-L31

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Igor Velikorossov (@RussKie) TestingPlatformCommandLineArguments is currently used when invoking dotnet test but not when invoked via Arcade.

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.

What would be the right way to fix this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think you can simply append TestingPlatformCommandLineArguments to _TestRunnerArgs.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Hmm, what I'm suggesting won't probably be possible without my PR on Arcade side. For now I think you could duplicate the --ignore-exit-code 8 on both sides.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Or simply just rename Aspire.Components.Common.Tests to end with TestUtilities if it's really not intended to be a test project, then you don't need the --ignore-exit-code 8 at all.

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.

Or simply just rename Aspire.Components.Common.Tests to end with TestUtilities if it's really not intended to be a test project, then you don't need the --ignore-exit-code 8 at all.

Yep, working on it

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.

I don't think we can do it easily (if at all).
The project uses XUnit API (like fact and theory), and we need to import the Xunit assemblies. Those are defined in eng/Xunit3/Xunit3.targets and can only be imported by test projects. If the targets imported explicitly, then the build gets failed by _XunitValidateBuild declared in xunit.v3.core.targets

D:\Development\dotnet-aspire\.packages\xunit.v3.core\2.0.0\buildTransitive\xunit.v3.core.targets(15,5): xUnit.net v3 test projects must be executable (set project property '<OutputType>Exe</OutputType>'). If this is not a test project, reference xunit.v3.extensibilty.core instead. [D:\Development\dotnet-aspire\tests\Aspire.Components.Common.Tests\Aspire.Components.Common.TestUtilities.csproj]

@Youssef1313 Youssef Fahmy (Youssef1313) Apr 10, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Igor Velikorossov (@RussKie) You need to reference only xunit.v3.extensibility.core in that project, and not xunit.v3.core, nor xunit.v3

</PropertyGroup>

<ItemGroup>
Expand Down
30 changes: 4 additions & 26 deletions tests/Aspire.EndToEnd.Tests/.runsettings
Original file line number Diff line number Diff line change
@@ -1,26 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<xUnit>
<ShowLiveOutput>true</ShowLiveOutput>
</xUnit>
<RunConfiguration>
<!-- Timeout in ms, 15 minutes -->
<TestSessionTimeout>900000</TestSessionTimeout>
<!-- Filter out failing (wrong framework, platform, runtime or activeissue) tests -->
<TestCaseFilter>category!=failing</TestCaseFilter>
</RunConfiguration>
<LoggerRunSettings>
<Loggers>
<Logger friendlyName="trx">
<Configuration>
<LogFileName>TestResults.trx</LogFileName>
</Configuration>
</Logger>
<Logger friendlyName="console">
<Configuration>
<Verbosity>normal</Verbosity>
</Configuration>
</Logger>
</Loggers>
</LoggerRunSettings>
</RunSettings>
--show-live-output on

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.

if we wanted to experiment with parallel tests runs for a particular library, we'd put it in a file like this presumably? (right now none may be stable for parallel runs, nor diagnosable, but for traditional unit tests it may be possible)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Either that, or add it to TestingPlatformCommandLineArguments.

Note: the current file is no longer really runsettings, it's a response file. RunSettings is actually not supported by core MTP (there is limited support for it through VSTestBridge, but xUnit doesn't use the bridge).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You can also do dotnet run --project path/to/test-project.csproj -- --help and it will show you all the command-line options available.

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.

why do we still have .runsettings if it's not really supported?

@Youssef1313 Youssef Fahmy (Youssef1313) Apr 2, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The file name is just .runsettings but it acts as a command-line response file. I can rename for clarity.

The original intent is very unclear to me, there are too many .runsettings scattered and it's not claer which is used for what and when.

If you can clarify the original intent, maybe there can be a good room to clean it up more.

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.

I cannot clarify. Possibly Ankit Jain (@radical) can or perhaps it's just happenstance, this isn't a mature repo. Any cleanup welcome!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Okay, I went ahead and cleaned up all the .runsettings.

Any customizations that are needed for a specific project can be done via TestingPlatformCommandLineArguments MSBuild property. This allows more flexibility as you can customize in Directory.Build.[props|targets] as well, based on any conditions. Previously, only one .runsettings file can be passed, and it was too hard to track which runsettings is used where.

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.

We have various runsettings to have different logging and timeout setup, and the files themselves weren't compostable. This was useful for local vs CI runs. I did start moving to overriding on the command line. But cleaning all this up to use command line parameters via msbuild properties will be great!!


# Filter out failing (wrong framework, platform, runtime or activeissue) tests
--filter-not-trait "category=failing"
Comment thread
danmoseley marked this conversation as resolved.
Outdated
Loading