Skip to content

Commit 071d5c5

Browse files
committed
Add dotnet.config to specify MTP for dotnet test
1 parent 28f379f commit 071d5c5

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

.github/copilot-instructions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,18 @@ In building and testing, never use `dotnet` without extension. Use `dotnet.sh` o
4747

4848
Note that tests for a project can be executed without first building from the root.
4949

50-
(4) To run just certain tests, it's important to include the filter after `--`, for example `dotnet.sh test tests/Aspire.Hosting.Testing.Tests/Aspire.Hosting.Testing.Tests.csproj --no-build --logger "console;verbosity=detailed" -- --filter "TestingBuilderHasAllPropertiesFromRealBuilder"`
50+
(4) To run just certain tests, it's important to include the filter after `--`, for example `dotnet.sh test tests/Aspire.Hosting.Testing.Tests/Aspire.Hosting.Testing.Tests.csproj --no-build --filter "TestingBuilderHasAllPropertiesFromRealBuilder"`
5151

5252
### Important: Excluding Quarantined Tests
5353

5454
When running tests in automated environments (including Copilot agent), **always exclude quarantined tests** to avoid false negatives:
5555

5656
```bash
5757
# Correct - excludes quarantined tests (use this in automation)
58-
dotnet.sh test tests/Project.Tests/Project.Tests.csproj -- --filter-not-trait "quarantined=true"
58+
dotnet.sh test tests/Project.Tests/Project.Tests.csproj --filter-not-trait "quarantined=true"
5959

6060
# For specific test filters, combine with quarantine exclusion
61-
dotnet.sh test tests/Project.Tests/Project.Tests.csproj -- --filter "TestName" --filter-not-trait "quarantined=true"
61+
dotnet.sh test tests/Project.Tests/Project.Tests.csproj --filter "TestName" --filter-not-trait "quarantined=true"
6262
```
6363

6464
Never run all tests without the quarantine filter in automated environments, as this will include flaky tests that are known to fail intermittently.

.github/workflows/run-tests.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ jobs:
229229
run: >
230230
dotnet ${{ env.TEST_ASSEMBLY_NAME }}.dll
231231
--ignore-exit-code 8
232+
--no-progress
232233
--report-trx --report-trx-filename "${{ inputs.testShortName }}.trx"
233234
--hangdump --hangdump-timeout ${{ inputs.testHangTimeout }}
234235
--crashdump
@@ -249,14 +250,14 @@ jobs:
249250
# So, we manually set NUGET_PACKAGES
250251
NUGET_PACKAGES: ${{ github.workspace }}/.packages
251252
run: >
252-
${{ env.DOTNET_SCRIPT }} test ${{ env.TEST_PROJECT_PATH }}
253+
${{ env.DOTNET_SCRIPT }} test --project ${{ env.TEST_PROJECT_PATH }}
253254
/p:ContinuousIntegrationBuild=true
254255
/p:TrxFileNamePrefix="${{ inputs.testShortName }}"
255256
-bl:${{ github.workspace }}/testresults/test.binlog
256257
--no-restore
257258
--no-build
258-
--
259259
--ignore-exit-code 8
260+
--no-progress
260261
--report-trx
261262
--hangdump --hangdump-timeout ${{ inputs.testHangTimeout }}
262263
--crashdump

dotnet.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[dotnet.test.runner]
2+
name = "Microsoft.Testing.Platform"

tests/helix/send-to-helix-buildonhelixtests.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<_TestBlameArguments Include="--crashdump-type Full" />
3636

3737
<!-- Using `dotnet test` for the project directly here -->
38-
<_TestRunCommandArguments Include="dotnet test -- --results-directory $(_HelixLogsPath) --report-trx --report-trx-filename TestResults.trx" />
38+
<_TestRunCommandArguments Include="dotnet test --results-directory $(_HelixLogsPath) --no-progress --report-trx --report-trx-filename TestResults.trx" />
3939
<_TestRunCommandArguments Include="@(_TestBlameArguments, ' ')" />
4040

4141
<_TestRunCommandArguments Include="--filter-not-trait &quot;quarantined=true&quot;" />

0 commit comments

Comments
 (0)