Replies: 2 comments
-
|
Otherwise there is currently no official way to build a solution and then filter the projects to run only selected projects. Closest is a solution filter file. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Are you using MSTest or NUnit with Microsoft.Testing.Platform? You can try this: <!-- IsTestProject lets dotnet test command to know this is not a VSTest test project -->
<IsTestProject Condition="'$(SkipDeployedTests)' == 'true'">false</IsTestProject>
<!-- EnableMSTestRunner is the right point for MSTest+MTP to correctly set IsTestingPlatformApplication -->
<!-- This tells dotnet test command to know this is not a Microsoft.Testing.Platform test project -->
<!-- Combined outcome is that this project will be ignored by test command -->
<!-- NOTE:: Use EnableNUnitRunner instead if you use NUnit. -->
<EnableMSTestRunner Condition="'$(SkipDeployedTests)' == 'true'">false</EnableMSTestRunner>
<!-- Also set OutputType to Library based on the same condition, depending on how you set it to Exe --> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
How can I run
dotnet testagainst a solution file, but skip a specific projectsWith MSTest, we handled this by using
dotnet test Foo.sln, and thenAt first glance, it looks like
IsTestingPlatformApplicationwould be equivalent, but turning<IsTestingApplicationProject >off by itself is not enough as you need to change<OutputType>back to library to avoid compilation errors.Even if that works, this is not ideal - we do actually want to run these tests, but at a later point in the pipeline. We could really benefit from MTP's capability to publishing the application as a test application, so we only need to run the already compiled application, rather than having to check out the source code, and build it before testing it. So really we do want to compile them as test applications, we just don't want
dotnet testto run them at this point in CI. We can fudge around this if we also enableGenerateTestingPlatformEntryPointandGenerateSelfRegisteredExtensions, but that feels rather messy, and also ends up fighting with nunit - see nunit/nunit3-vs-adapter#1378Do you have any better suggestions for how we could handle this?
For context, our pipeline roughly does the following:
Job 1: Build & Test
dotnet restore foo.slnxdotnet build foo.slnxdotnet test --solution foo.slnx# We want this to run all tests exceptFoo.DeploymentTestsdotnet pack foo.slnxdotnet publish foo.slnx# deployment tests set<IsPublishable>true so the test can be picked upJob 2: Deployment Validation
Foo.DeploymentTests.exeagainst the deployment (obtained fromdotnet publishartifacts from previous stage) # the deployment test applicationBeta Was this translation helpful? Give feedback.
All reactions