-
Notifications
You must be signed in to change notification settings - Fork 19
Add support for Microsoft.Testing.Platform #152
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
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
dd8667c
Add support for Microsoft.Testing.Platform
Evangelink 288aaba
Update test and fix infra
Evangelink 0a50cf2
Merge branch 'main' into microsoft-testing-platform
Evangelink f5901b8
Update PR
Evangelink 0f8f90d
Merge branch 'main' into microsoft-testing-platform
Evangelink 4b58410
Fix missing parts
Evangelink e76696c
Remove whitespaces
Evangelink 0d0ac6f
Refactor tests to depends on nuget produced by build
Evangelink 642d532
fix ci
Alxandr d15d33c
Merge branch 'main' into microsoft-testing-platform
Alxandr 8a41bbf
clean
Alxandr ca99581
Bump version to 1.3.2
Evangelink 9af6410
Update project to enable properties based on CLI
Evangelink 5034051
chore: add ability to run failing tests
Alxandr 084d411
check failing tests
Alxandr 6c447cf
ci: use bash instead of pwsh
Alxandr a142595
Change default of some properties
Evangelink b0a4df9
Merge branch 'main' into microsoft-testing-platform
Evangelink dbc8f68
Update Directory.Packages.props
Evangelink 6c3553f
Update opt-out condition
Evangelink d87e225
Merge branch 'main' into microsoft-testing-platform
Evangelink 739bb2c
Remove nullable disable
Evangelink 5ac9596
Handle last few issues
Evangelink 3bce11a
Update src/YoloDev.Expecto.TestSdk/build/net6.0/YoloDev.Expecto.TestS…
Evangelink 718ffa0
Merge branch 'main' into microsoft-testing-platform
Evangelink fef67cc
Fix nullability issues
Evangelink 1c4389d
EnableExpectoRunner -> EnableExpectoTestingPlatformIntegration
Evangelink File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| [private] | ||
| @list: | ||
| just --list | ||
|
|
||
| restore: | ||
| dotnet restore -p:Configuration=Release | ||
|
|
||
| build: restore | ||
| dotnet build --configuration Release --no-restore | ||
|
|
||
| pack: build | ||
| dotnet pack --configuration Release --no-build | ||
|
|
||
| test-platform: pack | ||
| dotnet clean ./test/Sample.Test/Sample.Test.fsproj -v:quiet | ||
| dotnet test ./test/Sample.Test/Sample.Test.fsproj -p:EnableExpectoTestingPlatformIntegration=true -p:IncludeFailingTests=false | ||
|
|
||
| test-platform-failing: pack | ||
| dotnet clean ./test/Sample.Test/Sample.Test.fsproj -v:quiet | ||
| dotnet test ./test/Sample.Test/Sample.Test.fsproj -p:EnableExpectoTestingPlatformIntegration=true -p:IncludeFailingTests=true | ||
|
|
||
| test-legacy: pack | ||
| dotnet clean ./test/Sample.Test/Sample.Test.fsproj -v:quiet | ||
| dotnet test ./test/Sample.Test/Sample.Test.fsproj -p:EnableExpectoTestingPlatformIntegration=false -p:IncludeFailingTests=false | ||
|
|
||
| test-legacy-failing: pack | ||
| dotnet clean ./test/Sample.Test/Sample.Test.fsproj -v:quiet | ||
| dotnet test ./test/Sample.Test/Sample.Test.fsproj -p:EnableExpectoTestingPlatformIntegration=false -p:IncludeFailingTests=true | ||
|
|
||
| @check-platform: | ||
| #!/usr/bin/env bash | ||
| just test-platform | ||
|
|
||
| just test-platform-failing | ||
| status=$? | ||
|
|
||
| if [ $status -eq 0 ]; then | ||
| echo "Expected tests to fail, but they passed (status code: $Status)" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Test run worked as expected" | ||
|
|
||
| @check-legacy: | ||
| #!/usr/bin/env bash | ||
| just test-legacy | ||
|
|
||
| just test-legacy-failing | ||
| status=$? | ||
|
|
||
| if [ $status -eq 0 ]; then | ||
| echo "Expected tests to fail, but they passed (status code: $Status)" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Test run worked as expected" | ||
|
|
||
| @test: check-platform check-legacy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,11 @@ | ||
| <Project> | ||
|
|
||
| <ItemGroup> | ||
| <PackageVersion Include="Expecto" Version="[10.0, 11.0)" /> | ||
| <PackageVersion Include="FSharp.Core" Version="[7.0.200,)" /> | ||
| <PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" /> | ||
| <PackageVersion Include="Microsoft.Testing.Extensions.VSTestBridge" Version="1.5.1" /> | ||
| <PackageVersion Include="Microsoft.Testing.Platform.MSBuild" Version="1.5.1" /> | ||
| <PackageVersion Include="Microsoft.TestPlatform.ObjectModel" Version="17.12.0" /> | ||
| <PackageVersion Include="System.Collections.Immutable" Version="[6.0.1,)" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| namespace YoloDev.Expecto.TestSdk | ||
|
|
||
| open System.Reflection | ||
|
|
||
| open Microsoft.Testing.Extensions.VSTestBridge.Capabilities | ||
| open Microsoft.Testing.Extensions.VSTestBridge.Helpers | ||
| open Microsoft.Testing.Platform.Builder | ||
| open Microsoft.Testing.Platform.Capabilities.TestFramework | ||
|
|
||
| module TestApplicationBuilderExtensions = | ||
| let addExpectoFramework (getTestAssemblies: unit -> Assembly seq) (builder: ITestApplicationBuilder) = | ||
| let expectoExtension = ExpectoExtension() | ||
| builder.AddRunSettingsService expectoExtension | ||
| builder.AddTestCaseFilterService expectoExtension | ||
| builder.RegisterTestFramework ( | ||
| (fun _ -> TestFrameworkCapabilities(VSTestBridgeExtensionBaseCapabilities())), | ||
| (fun capabilities serviceProvider -> new ExpectoTestFramework(expectoExtension, getTestAssemblies, serviceProvider, capabilities)) | ||
| ) |> ignore | ||
|
|
||
| module TestingPlatformBuilderHook = | ||
| let AddExtensions(builder: ITestApplicationBuilder, arguments: string array) = | ||
| TestApplicationBuilderExtensions.addExpectoFramework (fun () -> [ Assembly.GetEntryAssembly() ]) builder | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 21 additions & 5 deletions
26
src/YoloDev.Expecto.TestSdk/build/net6.0/YoloDev.Expecto.TestSdk.props
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,26 @@ | ||
| <Project> | ||
|
|
||
| <PropertyGroup> | ||
| <!-- Makes the new platform/runner opt-in feature --> | ||
| <EnableExpectoTestingPlatformIntegration Condition=" '$(EnableExpectoTestingPlatformIntegration)' == '' ">false</EnableExpectoTestingPlatformIntegration> | ||
| <!-- Defines the new platform capability --> | ||
| <IsTestingPlatformApplication>$(EnableExpectoTestingPlatformIntegration)</IsTestingPlatformApplication> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <!-- | ||
| !!! IMPORTANT !!! | ||
| DO NOT CHANGE THE GUID, IT'S A WELL KNOWN EXTENSION POINT AND THIS EXTENSION NEEDS TO BE REGISTERED AT THE END | ||
| WE HAVE CODE INSIDE THE TASK 'TestingPlatformEntryPoint' TO ENSURE THE ORDER OF THE REGISTRATION BASED ON THIS GUID | ||
| --> | ||
| <TestingPlatformBuilderHook Include="CFC308E5-E1A5-4B99-8002-17EF4D55D043"> | ||
| <DisplayName>Expecto</DisplayName> | ||
| <TypeFullName>YoloDev.Expecto.TestSdk.TestingPlatformBuilderHook</TypeFullName> | ||
Evangelink marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| </TestingPlatformBuilderHook> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <None Include="$(MSBuildThisFileDirectory)expecto.visualstudio.dotnetcore.testadapter.dll"> | ||
| <Link>expecto.visualstudio.dotnetcore.testadapter.dll</Link> | ||
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
| <Visible>False</Visible> | ||
| </None> | ||
| <ProjectCapability Include="TestContainer" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> | ||
32 changes: 32 additions & 0 deletions
32
src/YoloDev.Expecto.TestSdk/build/net6.0/YoloDev.Expecto.TestSdk.targets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| <Project> | ||
|
|
||
| <!-- Handle the coexistance between testing platform and Microsoft.NET.Test.Sdk --> | ||
| <PropertyGroup> | ||
| <GenerateTestingPlatformEntryPoint Condition=" '$(GenerateTestingPlatformEntryPoint)' == '' ">$(EnableExpectoTestingPlatformIntegration)</GenerateTestingPlatformEntryPoint> | ||
| <GenerateSelfRegisteredExtensions Condition=" '$(GenerateSelfRegisteredExtensions)' == '' ">$(EnableExpectoTestingPlatformIntegration)</GenerateSelfRegisteredExtensions> | ||
| <GenerateProgramFile Condition=" '$(EnableExpectoTestingPlatformIntegration)' == 'true' ">false</GenerateProgramFile> | ||
| <DisableTestingPlatformServerCapability Condition=" '$(EnableExpectoTestingPlatformIntegration)' != 'true' " >true</DisableTestingPlatformServerCapability> | ||
| </PropertyGroup> | ||
|
|
||
| <Choose> | ||
| <!-- Avoid false warning about missing reference (msbuild bug) --> | ||
| <!-- https://github.com/dotnet/msbuild/issues/9698#issuecomment-1945763467 --> | ||
| <When Condition=" '$(EnableExpectoTestingPlatformIntegration)' == 'true' "> | ||
| <ItemGroup> | ||
| <Reference Include="expecto.visualstudio.dotnetcore.testadapter"> | ||
| <HintPath>$(MSBuildThisFileDirectory)expecto.visualstudio.dotnetcore.testadapter.dll</HintPath> | ||
| </Reference> | ||
| </ItemGroup> | ||
| </When> | ||
| <Otherwise> | ||
| <ItemGroup> | ||
| <None Include="$(MSBuildThisFileDirectory)expecto.visualstudio.dotnetcore.testadapter.dll"> | ||
| <Link>expecto.visualstudio.dotnetcore.testadapter.dll</Link> | ||
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
| <Visible>False</Visible> | ||
| </None> | ||
| </ItemGroup> | ||
| </Otherwise> | ||
| </Choose> | ||
|
|
||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| .packages/ |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.