-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add test for dotnet test with UseAppHost=false in MTP #50109
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
Open
Copilot
wants to merge
10
commits into
main
Choose a base branch
from
copilot/fix-49718
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+93
−0
Open
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
493d71b
Initial plan
Copilot e5472b2
Add architecture validation for MTP with UseAppHost=false
Copilot e85f76c
Finalize architecture validation implementation and test improvements
Copilot 1758fb4
Remove redundant GenerateProgramFile property from test project
Copilot 628f1b7
Address review feedback: remove redundant properties, create dotnet.c…
Copilot 5ca0e6b
Remove --arch from test, rename to RunMTPProjectWithUseAppHostFalse_S…
Copilot 9625aa8
Remove SkipTestPlatformReferences property usage
Copilot 81738f9
Update test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRu…
Youssef1313 ec86d01
Update TestProjectMTPWithUseAppHostFalse.csproj
Youssef1313 791bf3b
Update dotnet.config
Youssef1313 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
57 changes: 57 additions & 0 deletions
57
test/TestAssets/TestProjects/TestProjectMTPWithUseAppHostFalse/Program.cs
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,57 @@ | ||
using Microsoft.Testing.Platform.Builder; | ||
using Microsoft.Testing.Platform.Capabilities.TestFramework; | ||
using Microsoft.Testing.Platform.Extensions.Messages; | ||
using Microsoft.Testing.Platform.Extensions.TestFramework; | ||
|
||
var testApplicationBuilder = await TestApplication.CreateBuilderAsync(args); | ||
|
||
testApplicationBuilder.RegisterTestFramework(_ => new TestFrameworkCapabilities(), (_, __) => new DummyTestAdapter()); | ||
|
||
using var testApplication = await testApplicationBuilder.BuildAsync(); | ||
return await testApplication.RunAsync(); | ||
|
||
public class DummyTestAdapter : ITestFramework, IDataProducer | ||
{ | ||
public string Uid => nameof(DummyTestAdapter); | ||
|
||
public string Version => "2.0.0"; | ||
|
||
public string DisplayName => nameof(DummyTestAdapter); | ||
|
||
public string Description => nameof(DummyTestAdapter); | ||
|
||
public Task<bool> IsEnabledAsync() => Task.FromResult(true); | ||
|
||
public Type[] DataTypesProduced => []; | ||
|
||
public Task<CreateTestSessionResult> CreateTestSessionAsync(CreateTestSessionContext context) | ||
=> Task.FromResult(new CreateTestSessionResult() { IsSuccess = true }); | ||
|
||
public Task<CloseTestSessionResult> CloseTestSessionAsync(CloseTestSessionContext context) | ||
=> Task.FromResult(new CloseTestSessionResult() { IsSuccess = true }); | ||
|
||
public Task ExecuteRequestAsync(ExecuteRequestContext context) | ||
{ | ||
// Simple dummy test that always passes | ||
context.MessageBus.PublishAsync(this, new TestNodeUpdateMessage( | ||
context.Request.Session.SessionUid, | ||
new TestNode() | ||
{ | ||
Uid = "dummy_test_1", | ||
DisplayName = "Dummy Test 1", | ||
Properties = new PropertyBag() | ||
})); | ||
|
||
context.MessageBus.PublishAsync(this, new TestResultMessage( | ||
context.Request.Session.SessionUid, | ||
new PassedTestResult() | ||
{ | ||
Uid = "dummy_test_1", | ||
DisplayName = "Dummy Test 1", | ||
Duration = TimeSpan.FromMilliseconds(1) | ||
})); | ||
|
||
context.Complete(); | ||
return Task.CompletedTask; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...s/TestProjects/TestProjectMTPWithUseAppHostFalse/TestProjectMTPWithUseAppHostFalse.csproj
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,20 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), testAsset.props))\testAsset.props" /> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>$(CurrentTargetFramework)</TargetFramework> | ||
<OutputType>Exe</OutputType> | ||
<UseAppHost>false</UseAppHost> | ||
|
||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally> | ||
<IsTestingPlatformApplication>true</IsTestingPlatformApplication> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<!-- Use a simplified approach without external package dependency --> | ||
Youssef1313 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<PackageReference Include="Microsoft.Testing.Platform" Version="$(MicrosoftTestingPlatformVersion)" Condition="'$(SkipTestPlatformReferences)' != 'true'" /> | ||
Youssef1313 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</ItemGroup> | ||
</Project> |
5 changes: 5 additions & 0 deletions
5
test/TestAssets/TestProjects/TestProjectMTPWithUseAppHostFalse/dotnet.config
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,5 @@ | ||
[general] | ||
telemetry-output=false | ||
|
||
[testing.platform] | ||
use-microsoft-testing-platform=true | ||
Youssef1313 marked this conversation as resolved.
Show resolved
Hide resolved
|
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
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.