Skip to content
Closed
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
3aa3239
Update Directory.Packages.props for xUnit v3
mikaelweave Apr 17, 2026
0d73fd6
Update Directory.Build.props for xUnit v3 + MTP
mikaelweave Apr 17, 2026
25e30d3
Update ruleset, notices, and xunit.runner.json for xUnit v3
mikaelweave Apr 17, 2026
b856c92
Microsoft.Health.Extensions.Xunit: swap xunit -> xunit.v3.*
mikaelweave Apr 17, 2026
61da2c3
Rewrite Custom* xunit test framework types for xUnit v3
mikaelweave Apr 17, 2026
b37f0e0
Replace TestClassWithFixtureArguments with FixtureArgumentSet* for v3
mikaelweave Apr 17, 2026
a4c99e9
Port retry attributes and add local Skip/SkippableFact/SkippableTheory
mikaelweave Apr 17, 2026
492e799
Update unit test csprojs: xunit -> xunit.v3.mtp-v2
mikaelweave Apr 17, 2026
5f70985
Update integration test csprojs: xunit -> xunit.v3.mtp-v2
mikaelweave Apr 17, 2026
8f03bdf
Update E2E test csprojs: xunit -> xunit.v3.mtp-v2
mikaelweave Apr 17, 2026
f5923df
Update AssemblyInfo attributes for xUnit v3
mikaelweave Apr 17, 2026
d26ae5d
Convert test fixtures to ValueTask-based IAsyncLifetime for xUnit v3
mikaelweave Apr 17, 2026
ae17d46
Register Shared.Tests.Integration xunit.runner.json and update E2E pr…
mikaelweave Apr 17, 2026
adf3e04
Disable parallelization for CustomQueries tests under xUnit v3
mikaelweave Apr 17, 2026
cb2da1d
Remove stale Xunit.Abstractions using in SqlServerImporterIntegration…
mikaelweave Apr 17, 2026
4173181
Publish TRX results from MTP runner in CI
mikaelweave Apr 17, 2026
6ecc54e
Convert CI test filters to xUnit v3 MTP filter-query syntax
mikaelweave Apr 17, 2026
1f2d510
Add pre-test 'Verify xUnit config' CI step for integration jobs
mikaelweave Apr 17, 2026
a509b20
Fix remaining xUnit v3 compile errors in shared tests
mikaelweave Apr 17, 2026
7ed048e
Honor CollectionDefinition.DisableParallelization in custom discoverer
mikaelweave Apr 17, 2026
195fb3f
Disable test collection parallelization for Integration tests
mikaelweave Apr 17, 2026
52352fd
Fix test parallelism: share collection per (class, variant) to match …
mikaelweave Apr 17, 2026
bddbf25
Scope fixture-argument-set test collections per class to restore para…
mikaelweave Apr 17, 2026
d18d66e
Align unit test publish to MTP retry workaround (testfx#7167)
mikaelweave Apr 18, 2026
adebd46
Fix xUnit3 migration review issues
mikaelweave Apr 19, 2026
1fe50e4
Merge branch 'main' into personal/mikaelw/xunit3-v2
mikaelweave Apr 28, 2026
bf4d0c1
Address CodeQL review suggestions
mikaelweave Apr 28, 2026
5b15071
Merge remote-tracking branch 'origin/main' into agents/pipeline-failu…
mikaelweave Apr 29, 2026
52f7f93
Merge remote-tracking branch 'origin/main' into personal/mikaelw/xuni…
Copilot May 27, 2026
840621e
Fix xUnit v3 test compile failures
mikaelweave May 27, 2026
7e5719a
Run E2E tests serially under xUnit v3
mikaelweave May 28, 2026
7008e8f
Address xUnit migration review feedback
mikaelweave May 28, 2026
c2ab3a2
Fix xUnit3 review issues: IsExplicitCollection logic, dead code cleanup
mikaelweave May 28, 2026
ebb2af4
Merge remote-tracking branch 'origin/main' into xunit3 branch
mikaelweave Aug 20, 2026
4e6c339
Fix xUnit v3 compile errors in files merged from main
mikaelweave Aug 20, 2026
08fa85d
Align unit test result publishing with main's revert of testfx#7167 w…
mikaelweave Aug 20, 2026
5617602
Fix RetryFact failures silently disappearing from test results
mikaelweave Aug 20, 2026
872507c
Fix fixture-variant display names and remove dead xUnit v3 shim code
mikaelweave Aug 20, 2026
89cb4f6
Stop suppressing xUnit1031 repo-wide
mikaelweave Aug 20, 2026
3133160
Add missing XML documentation to Extensions.Xunit public API
mikaelweave Aug 20, 2026
877a671
Stop RetryFact losing failures when a run is cancelled
mikaelweave Aug 20, 2026
ee25af0
Fix using order instead of suppressing SA1208/SA1209/SA1518
mikaelweave Aug 20, 2026
bbb52d8
Stop RetryFact reporting a phantom failure for a test that passed
mikaelweave Aug 20, 2026
07d4207
Make xUnit shim fallbacks loud and drop unreachable code
mikaelweave Aug 20, 2026
316feca
Fail the build when a test run publishes no TRX file
mikaelweave Aug 20, 2026
9ce60df
Add regression tests for the xUnit extensions
mikaelweave Aug 20, 2026
a019857
Address multi-model PR review findings for the xUnit v3 extensions
mikaelweave Aug 21, 2026
fcf7937
Harden the xUnit v3 extensions against round-2 review findings
mikaelweave Aug 21, 2026
0e85232
Keep fixture argument set variants in their original test collection
mikaelweave Aug 21, 2026
1650509
Report discovery faults, keep theory rows, and stop retries being can…
mikaelweave Aug 21, 2026
60fe3aa
Stop trait filters and cancellation from hiding discovery faults
mikaelweave Aug 21, 2026
c4d5cd8
Restore parallelism bound and contain discovery faults to one method
mikaelweave Aug 21, 2026
c9b5b00
Merge remote-tracking branch 'origin/main' into mikaelweave-xunit3-pr…
mikaelweave Aug 21, 2026
0f29c51
Report discovery faults per argument set and carry their real cause
mikaelweave Aug 21, 2026
0d6769c
Report a discovery fault once per lost test, not once per class
mikaelweave Aug 21, 2026
a3857d6
Inherit the dimensions a method's attribute does not declare
mikaelweave Aug 21, 2026
a83b644
Keep a method whose test-ness cannot be read, and refuse a mismatched…
mikaelweave Aug 21, 2026
85119c8
Put the variant's traits on the error case xunit builds for a broken …
mikaelweave Aug 21, 2026
b753090
Say what a misread assertion type actually costs a retrying test
mikaelweave Aug 21, 2026
34b355a
Name the attribute that is wrong instead of an array index
mikaelweave Aug 21, 2026
5d4ebd9
Stop a collection definition from hiding the tests of classes that jo…
mikaelweave Aug 21, 2026
6b7d555
Pin a variant of a class that also joins a trait-carrying collection
mikaelweave Aug 22, 2026
810332a
Actually compile the collection definition the E2E classes join
mikaelweave Aug 22, 2026
64a9236
Remove a probe file a review agent left in the tree
mikaelweave Aug 22, 2026
079705d
Read argument set values from metadata when the attribute will not co…
mikaelweave Aug 22, 2026
5001ae3
Pin the trait on a method expanded without a class-level declaration
mikaelweave Aug 22, 2026
9f7ba55
Cover retries and fixture argument set variants together
mikaelweave Aug 22, 2026
d4b78bc
Fail discovery when a variant's traits cannot be applied
mikaelweave Aug 22, 2026
259c205
Retry a test that timed out
mikaelweave Aug 22, 2026
196ecae
Pin the decision RetryOnAssertionFailure makes
mikaelweave Aug 22, 2026
cd886d5
Keep a fault's traits when one trait attribute throws
mikaelweave Aug 22, 2026
e89c802
Ask whether an attempt failed, not whether it deferred
mikaelweave Aug 22, 2026
5f6b89c
Do not let a skip erase a failure the test already showed
mikaelweave Aug 22, 2026
79ebf92
Make an empty test leg fail instead of pass
mikaelweave Aug 22, 2026
6f45be1
Say what these comments actually describe
mikaelweave Aug 22, 2026
458a199
Pin the trait a positively-filtered leg actually selects on
mikaelweave Aug 22, 2026
5d8bf60
Report a declaration that names no value under every value it could have
mikaelweave Aug 22, 2026
23388e5
Give the integration legs the same floor as the filtered ones
mikaelweave Aug 22, 2026
688119e
Say what these comments and names actually describe
mikaelweave Aug 22, 2026
59ed46a
Settle whether an attempt can report both an abstention and a failure
mikaelweave Aug 22, 2026
e00cda1
Honour the retry policy for an assertion failure that arrives wrapped
mikaelweave Aug 22, 2026
f9c0e26
Refuse a collection definition that tags classes it does not name
mikaelweave Aug 22, 2026
b030602
Take a cancellation-shaped failure for cancellation only when cancelled
mikaelweave Aug 22, 2026
4fd1fda
Recognise an assertion failure that shares its aggregate with others
mikaelweave Aug 22, 2026
70c12cc
Give a fault the traits of the collection its class joined
mikaelweave Aug 22, 2026
28d4b7e
Name the variant in retry diagnostics, not just the method
mikaelweave Aug 22, 2026
736331e
Let the E2E legs see the checks that guard the E2E assembly
mikaelweave Aug 22, 2026
490f1a3
Ask whether a collection definition carries a trait, not which attrib…
mikaelweave Aug 22, 2026
fb672b7
See a class join a collection by the v3 generic spelling
mikaelweave Aug 22, 2026
dda973a
Drop the losing attempt's messages instead of leaving them to be repl…
mikaelweave Aug 22, 2026
6760182
Keep the traits a broken attribute did not break
mikaelweave Aug 22, 2026
6fc4f56
Widen every argument set dimension that names nothing, not only all o…
mikaelweave Aug 22, 2026
286b1d0
Fail when the assembly stops declaring the framework its traits come …
mikaelweave Aug 22, 2026
0db80b5
Count the tests a leg selects before trusting it to have run them
mikaelweave Aug 22, 2026
8b6517c
Stop the last-resort fail-safe from crying wolf on a routine path
mikaelweave Aug 22, 2026
0fec0a3
Say why a deferred failure is not captured, and where parallelism com…
mikaelweave Aug 22, 2026
b3c2a87
Prove which test classes no CI leg is able to select
mikaelweave Aug 22, 2026
91efe88
Give the integration legs a floor too, and make every leg state its own
mikaelweave Aug 22, 2026
493afaf
Correct two comments that described behaviour the code does not have
mikaelweave Aug 22, 2026
30e55aa
Merge remote-tracking branch 'origin/main' into mikaelweave-xunit3-pr…
mikaelweave Aug 22, 2026
7fb265e
Stop the cancellation scenarios deciding by stopwatch who goes first
mikaelweave Aug 22, 2026
28b8cb4
Say out loud that assembly fixtures nothing asks for are still created
mikaelweave Aug 22, 2026
8eab515
Stop a failing test riding out of CI as a skip
mikaelweave Aug 22, 2026
6782a2e
Refuse two fixture argument set dimensions of the same enum type
mikaelweave Aug 22, 2026
c374829
Check leg reachability a method at a time, not a class at a time
mikaelweave Aug 22, 2026
d38b2b3
Notice when a unit test project stops matching the leg's glob
mikaelweave Aug 22, 2026
6b9a4d9
Refuse a retry outcome no one decided how to report
mikaelweave Aug 23, 2026
843bc75
Tell retried tests apart by identity, not by display name
mikaelweave Aug 23, 2026
a62c0e6
Name the projects the unit test leg is expected to run
mikaelweave Aug 23, 2026
44d01d5
Write each integration leg's store filter down once
mikaelweave Aug 23, 2026
b751342
Stop two harness assertions from passing on nothing
mikaelweave Aug 23, 2026
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
8 changes: 8 additions & 0 deletions CustomAnalysisRules.Test.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,12 @@
<Rule Id="CA2200" Action="None" />
<Rule Id="CA2234" Action="None" />
</Rules>
<Rules AnalyzerId="xUnit.Analyzers" RuleNamespace="xUnit.Analyzers">
<Rule Id="xUnit1031" Action="None" />
<Rule Id="xUnit1051" Action="None" />
</Rules>
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<Rule Id="SA1208" Action="None" />
<Rule Id="SA1209" Action="None" />
</Rules>
</RuleSet>
12 changes: 8 additions & 4 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@
<Choose>
<When Condition="$(MSBuildProjectName.Contains('UnitTest'))">
<ItemGroup>
<Content Include="$(MSBuildThisFileDirectory)/xunit.runner.json">
<None Include="$(MSBuildThisFileDirectory)/xunit.runner.json">
<Link>xunit.runner.json</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</When>
</Choose>

<!-- Test project configuration for xUnit 3 and Microsoft Testing Platform -->
<Choose>
<When Condition="$(MSBuildProjectName.Contains('Test')) AND '$(IsTestProject)' != 'false'">
<PropertyGroup>
Expand All @@ -45,13 +47,15 @@
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
<TestingPlatformCaptureOutput>false</TestingPlatformCaptureOutput>
<OutputType>Exe</OutputType>
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
<NoWarn>$(NoWarn);xUnit1031;xUnit1051;SA1208;SA1209;SA1518</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="YTest.MTP.XUnit2" />
<PackageReference Include="Microsoft.Testing.Extensions.Retry" />
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" />
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" />
<PackageReference Remove="xunit.runner.visualstudio" />
<PackageReference Include="Microsoft.Testing.Extensions.Telemetry" />
<PackageReference Include="Microsoft.Testing.Platform.MSBuild" />
</ItemGroup>
</When>
<When Condition="$(MSBuildProjectName.Contains('Test')) AND '$(IsTestProject)' == 'false'">
Expand Down
16 changes: 9 additions & 7 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@
<PackageVersion Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.4.0" />
<PackageVersion Include="Azure.Monitor.OpenTelemetry.AspNetCore" Version="1.2.0" />
<PackageVersion Include="Azure.Storage.Blobs" Version="12.21.2" />
<PackageVersion Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.1.0" />
<PackageVersion Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.3.1" />
<PackageVersion Include="Microsoft.Testing.Extensions.TrxReport" Version="2.0.2" />
<PackageVersion Include="Microsoft.Testing.Extensions.Telemetry" Version="2.0.2" />
<PackageVersion Include="Microsoft.Testing.Platform.MSBuild" Version="2.0.2" />
<PackageVersion Include="DotNet.ReproducibleBuilds" Version="1.2.25" />
<PackageVersion Include="Ensure.That" Version="10.1.0" />
<PackageVersion Include="FluentValidation" Version="11.11.0" />
Expand Down Expand Up @@ -132,13 +134,13 @@
<PackageVersion Include="System.IO.FileSystem.AccessControl" Version="5.0.0" />
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
<PackageVersion Include="System.Private.ServiceModel" Version="4.10.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.0.2" />
<PackageVersion Include="YTest.MTP.XUnit2" Version="1.0.3" />
<PackageVersion Include="xunit.v3" Version="3.2.2" />
<PackageVersion Include="xunit.v3.mtp-v2" Version="3.2.2" />
<PackageVersion Include="xunit.v3.assert" Version="3.2.2" />
<PackageVersion Include="xunit.v3.common" Version="3.2.2" />
<PackageVersion Include="xunit.v3.extensibility.core" Version="3.2.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
<PackageVersion Include="Microsoft.Testing.Extensions.Retry" Version="2.0.2" />
<PackageVersion Include="xunit.extensibility.core" Version="2.9.3" />
<PackageVersion Include="Xunit.SkippableFact" Version="1.5.23" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.assert" Version="2.9.3" />
<PackageVersion Include="System.Drawing.Common" Version="8.0.8" />
<PackageVersion Include="Moq" Version="4.20.69" />
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
Expand Down
55 changes: 0 additions & 55 deletions THIRDPARTYNOTICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -969,58 +969,3 @@ This file is based on or incorporates material from the projects listed below (T
> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> See the License for the specific language governing permissions and
> limitations under the License.

## YTest.MTP.XUnit2 1.0.3
* Component Source: https://github.com/Youssef1313/YTest.MTP.XUnit2
* Component Copyright and License:
> The MIT License (MIT)
>
> Copyright (c) Youssef Victor Gerges Fahmy
>
> All rights reserved.
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all
> copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> SOFTWARE.

## Xunit.SkippableFact 1.4.13
* Component Source: https://github.com/AArnott/Xunit.SkippableFact
* Component Copyright and License:
> This software is licensed under the Microsoft Public License
> http://opensource.org/licenses/ms-pl
>
> This license governs use of the accompanying software. If you use the software, you
> accept this license. If you do not accept the license, do not use the software.
>
> 1. Definitions
> The terms "reproduce," "reproduction," "derivative works," and "distribution" have the
> same meaning here as under U.S. copyright law.
> A "contribution" is the original software, or any additions or changes to the software.
> A "contributor" is any person that distributes its contribution under this license.
> "Licensed patents" are a contributor's patent claims that read directly on its contribution.
>
> 2. Grant of Rights
> (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
> (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
>
> 3. Conditions and Limitations
> (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
> (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
> (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
> (D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
> (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.

27 changes: 24 additions & 3 deletions build/jobs/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,40 @@ steps:
inputs:
command: test
projects: '**/*UnitTests/*.csproj'
arguments: '--configuration $(buildConfiguration) --no-build -f ${{parameters.targetBuildFramework}} -- --retry-failed-tests 3'
arguments: '--configuration $(buildConfiguration) --no-build -f ${{parameters.targetBuildFramework}} -- --retry-failed-tests 3 --report-trx'
publishTestResults: false
env:
platformOptions__resultDirectory: '$(Agent.TempDirectory)/unit-test-results'
- task: PublishTestResults@2
displayName: 'Publish unit test results'
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: '$(Agent.TempDirectory)/unit-test-results/**/*.trx'
mergeTestResults: true
testRunTitle: 'Unit Tests'
failTaskOnFailedTests: true
condition: succeededOrFailed()

- ${{ if eq(parameters.codeCoverage, 'true') }}:
- task: DotNetCoreCLI@2
displayName: 'dotnet test with coverage'
inputs:
command: test
projects: '**/*UnitTests/*.csproj'
arguments: '--configuration $(buildConfiguration) --no-build -f ${{parameters.targetBuildFramework}} -- --retry-failed-tests 3 --coverage --coverage-output-format cobertura --coverage-settings "$(System.DefaultWorkingDirectory)/CodeCoverage.Mtp.settings.xml"'
testRunTitle: 'Unit Tests'
arguments: '--configuration $(buildConfiguration) --no-build -f ${{parameters.targetBuildFramework}} -- --retry-failed-tests 3 --report-trx --coverage --coverage-output-format cobertura --coverage-settings "$(System.DefaultWorkingDirectory)/CodeCoverage.Mtp.settings.xml"'
publishTestResults: false
env:
platformOptions__resultDirectory: '$(Agent.TempDirectory)/coverage'
- task: PublishTestResults@2
displayName: 'Publish unit test with coverage results'
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: '$(Agent.TempDirectory)/coverage/**/*.trx'
mergeTestResults: true
testRunTitle: 'Unit Tests'
# TODO: Re-enable when https://github.com/microsoft/testfx/issues/7167 is fixed
failTaskOnFailedTests: false
condition: succeededOrFailed()
- task: reportgenerator@5
displayName: 'aggregate unit test coverage'
condition: succeededOrFailed()
Expand Down
11 changes: 8 additions & 3 deletions build/jobs/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,15 @@ steps:
throw "Could not find $testName.dll under $testRoot"
}

$filter = "FullyQualifiedName~${{ parameters.appServiceType }}&${{ parameters.categoryFilter }}"
$args = @('--filter', $filter, '--retry-failed-tests', '3', '--report-trx')
# xUnit v3 MTP filter-query: match DataStore trait for this app service type and any extra trait filters
$categoryFilter = '${{ parameters.categoryFilter }}'
$parts = $categoryFilter -split '&'
$allParts = @("DataStore=${{ parameters.appServiceType }}") + $parts
$traitFilter = "[" + (($allParts | ForEach-Object { "($_)" }) -join '&') + "]"
$filterQuery = "/$traitFilter"
$args = @('--filter-query', $filterQuery, '--retry-failed-tests', '3', '--report-trx')

Write-Host "Running dotnet $($dll.FullName)"
Write-Host "Running dotnet $($dll.FullName) with filter: $filterQuery"
& dotnet $dll.FullName @args

if ($LASTEXITCODE -ne 0) {
Expand Down
27 changes: 25 additions & 2 deletions build/jobs/run-cosmos-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,36 @@ jobs:
projects: '$(Pipeline.Workspace)/source/test/**/*${{ parameters.version }}.Tests.Integration.csproj'
arguments: '--configuration $(buildConfiguration) -f $(defaultBuildFramework)'

- task: PowerShell@2
displayName: 'Verify xUnit config'
inputs:
targetType: inline
pwsh: true
script: |
$ErrorActionPreference = 'Stop'
$projects = Get-ChildItem -Path "$(Pipeline.Workspace)/source/test" -Recurse -Filter "*${{ parameters.version }}.Tests.Integration.csproj"
if (-not $projects) {
throw "No integration test projects found under $(Pipeline.Workspace)/source/test."
}

foreach ($project in $projects) {
$outputDir = Join-Path $project.Directory.FullName "bin\$(buildConfiguration)\$(defaultBuildFramework)"
$configPath = Join-Path $outputDir "xunit.runner.json"
if (-not (Test-Path $configPath)) {
throw "xunit.runner.json not found for $($project.FullName) at $configPath"
}

Write-Host "xUnit config for $($project.BaseName): $configPath"
Get-Content -Path $configPath | ForEach-Object { Write-Host $_ }
}

- task: DotNetCoreCLI@2
displayName: 'Run Cosmos Integration Tests with coverage'
inputs:
command: test
projects: '$(Pipeline.Workspace)/source/test/**/*${{ parameters.version }}.Tests.Integration.csproj'
arguments: '--configuration $(buildConfiguration) --no-build -f $(defaultBuildFramework) -- --filter "FullyQualifiedName!~SqlServer" --retry-failed-tests 3 --coverage --coverage-output-format cobertura --coverage-settings "$(System.DefaultWorkingDirectory)/CodeCoverage.Mtp.settings.xml" --report-trx'
testRunTitle: '${{ parameters.version }} Cosmos Integration Tests'
arguments: '--configuration $(buildConfiguration) --no-build -f $(defaultBuildFramework) -- --filter-not-class "*SqlServer*" --filter-not-trait "DataStore=SqlServer" --retry-failed-tests 3 --coverage --coverage-output-format cobertura --coverage-settings "$(System.DefaultWorkingDirectory)/CodeCoverage.Mtp.settings.xml" --report-trx'
publishTestResults: false
env:
'CosmosDb__Host': $(CosmosDb--Host)
'FhirServer__ResourceManager__DataStoreResourceId': '$(DataStoreResourceId)'
Expand Down
8 changes: 4 additions & 4 deletions build/jobs/run-export-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ jobs:
throw "Could not find $testName.dll under $testRoot"
}

$args = @('--filter', 'FullyQualifiedName~CosmosDb&Category=ExportLongRunning', '--retry-failed-tests', '3', '--report-trx')
$args = @('--filter-query', '/[(DataStore=CosmosDb)&(Category=ExportLongRunning)]', '--retry-failed-tests', '3', '--report-trx')

Write-Host "Running dotnet $($dll.FullName)"
Write-Host "Running dotnet $($dll.FullName) with filter: /[(DataStore=CosmosDb)&(Category=ExportLongRunning)]"
& dotnet $dll.FullName @args

if ($LASTEXITCODE -ne 0) {
Expand Down Expand Up @@ -240,9 +240,9 @@ jobs:
throw "Could not find $testName.dll under $testRoot"
}

$args = @('--filter', 'FullyQualifiedName~SqlServer&Category=ExportLongRunning', '--retry-failed-tests', '3', '--report-trx')
$args = @('--filter-query', '/[(DataStore=SqlServer)&(Category=ExportLongRunning)]', '--retry-failed-tests', '3', '--report-trx')

Write-Host "Running dotnet $($dll.FullName)"
Write-Host "Running dotnet $($dll.FullName) with filter: /[(DataStore=SqlServer)&(Category=ExportLongRunning)]"
& dotnet $dll.FullName @args

if ($LASTEXITCODE -ne 0) {
Expand Down
27 changes: 25 additions & 2 deletions build/jobs/run-sql-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,36 @@ jobs:
projects: '$(Pipeline.Workspace)/source/test/**/*${{ parameters.version }}.Tests.Integration.csproj'
arguments: '--configuration $(buildConfiguration) -f $(defaultBuildFramework)'

- task: PowerShell@2
displayName: 'Verify xUnit config'
inputs:
targetType: inline
pwsh: true
script: |
$ErrorActionPreference = 'Stop'
$projects = Get-ChildItem -Path "$(Pipeline.Workspace)/source/test" -Recurse -Filter "*${{ parameters.version }}.Tests.Integration.csproj"
if (-not $projects) {
throw "No integration test projects found under $(Pipeline.Workspace)/source/test."
}

foreach ($project in $projects) {
$outputDir = Join-Path $project.Directory.FullName "bin\$(buildConfiguration)\$(defaultBuildFramework)"
$configPath = Join-Path $outputDir "xunit.runner.json"
if (-not (Test-Path $configPath)) {
throw "xunit.runner.json not found for $($project.FullName) at $configPath"
}

Write-Host "xUnit config for $($project.BaseName): $configPath"
Get-Content -Path $configPath | ForEach-Object { Write-Host $_ }
}

- task: DotNetCoreCLI@2
displayName: 'Run SQL Integration Tests with coverage'
inputs:
command: test
projects: '$(Pipeline.Workspace)/source/test/**/*${{ parameters.version }}.Tests.Integration.csproj'
arguments: '--configuration $(buildConfiguration) --no-build -f $(defaultBuildFramework) -- --filter "FullyQualifiedName!~CosmosDb" --retry-failed-tests 3 --coverage --coverage-output-format cobertura --coverage-settings "$(System.DefaultWorkingDirectory)/CodeCoverage.Mtp.settings.xml" --report-trx'
testRunTitle: '${{ parameters.version }} SQL Integration Tests'
arguments: '--configuration $(buildConfiguration) --no-build -f $(defaultBuildFramework) -- --filter-not-class "*CosmosDb*" --filter-not-trait "DataStore=CosmosDb" --retry-failed-tests 3 --coverage --coverage-output-format cobertura --coverage-settings "$(System.DefaultWorkingDirectory)/CodeCoverage.Mtp.settings.xml" --report-trx'
publishTestResults: false
env:
'SqlServer:ConnectionString': 'Server=tcp:${{ parameters.integrationSqlServerName }}.database.windows.net,1433;Initial Catalog=master;Persist Security Info=False;Authentication=ActiveDirectoryWorkloadIdentity;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;User Id=$(AZURESUBSCRIPTION_CLIENT_ID);'
platformOptions__resultDirectory: '$(Agent.TempDirectory)/coverage'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,12 @@
// -------------------------------------------------------------------------------------------------

using System;
using EnsureThat;

namespace Microsoft.Health.Extensions.Xunit
{
/// <summary>
/// Placed on an assembly to indicate that the given type should be instantiated
/// before any tests are executed and disposed (if it implements IDisposable)
/// at the end of the test run.
/// </summary>
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true, Inherited = false)]
[Obsolete("Use Xunit.AssemblyFixtureAttribute instead.")]
public sealed class AssemblyFixtureAttribute : Attribute
{
public AssemblyFixtureAttribute(Type fixtureType)
{
EnsureArg.IsNotNull(fixtureType, nameof(fixtureType));
FixtureType = fixtureType;
}

public Type FixtureType { get; }
}
}
Loading
Loading