I am using in the Test Filter criteria TestCategory=CategoryA In my Tests I have the below saved and think it should be the only test run but I get success and no tests ran. I have tried with dotnet test and used the same in the arguments and gain it fails with other issues. I can get dot net test to run without adding any arguments for VS Test agent it seems to not want to run even when I do not add the test filter criteria.
[Test]
[Category("CategoryA")]
public async Task ActivateDevice()
2022-02-18T20:14:54.5643568Z ##[section]Starting: VsTest - testAssemblies 2022-02-18T20:14:54.5771277Z ============================================================================== 2022-02-18T20:14:54.5771649Z Task : Visual Studio Test 2022-02-18T20:14:54.5772497Z Description : Run unit and functional tests (Selenium, Appium, Coded UI test, etc.) using the Visual Studio Test (VsTest) runner. Test frameworks that have a Visual Studio test adapter such as MsTest, xUnit, NUnit, Chutzpah (for JavaScript tests using QUnit, Mocha and Jasmine), etc. can be run. Tests can be distributed on multiple agents using this task (version 2). 2022-02-18T20:14:54.5773342Z Version : 2.198.0 2022-02-18T20:14:54.5773587Z Author : Microsoft Corporation 2022-02-18T20:14:54.5773921Z Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/test/vstest 2022-02-18T20:14:54.5774333Z ============================================================================== 2022-02-18T20:14:55.5713320Z SystemVssConnection exists true 2022-02-18T20:14:55.5732257Z SystemVssConnection exists true 2022-02-18T20:14:55.5991193Z Running tests using vstest.console.exe runner. 2022-02-18T20:14:55.5991725Z ====================================================== 2022-02-18T20:14:55.5997078Z Test selector : Test assemblies 2022-02-18T20:14:55.5998382Z Test filter criteria : null 2022-02-18T20:14:55.5999337Z Search folder : D:\a\r1\a 2022-02-18T20:14:55.6102675Z Action when minimum tests threshold not met : donothing 2022-02-18T20:14:55.6103140Z Minimum tests expected to be run: 0 2022-02-18T20:14:55.6104476Z VisualStudio version selected for test execution : latest 2022-02-18T20:14:55.6107744Z Attempting to find vstest.console from a visual studio installation with version [17.0,18.0). 2022-02-18T20:14:56.0357719Z Attempting to find vstest.console from a visual studio build tools installation with version [17.0,18.0). 2022-02-18T20:14:56.0642271Z Attempting to find vstest.console from a visual studio installation with version [16.0,17.0). 2022-02-18T20:14:56.0884398Z Attempting to find vstest.console from a visual studio build tools installation with version [16.0,17.0). 2022-02-18T20:14:56.1142098Z Attempting to find vstest.console from a visual studio installation with version [15.0,16.0). 2022-02-18T20:14:56.3498931Z Run in parallel : false 2022-02-18T20:14:56.3500994Z Run in isolation : false 2022-02-18T20:14:56.3502074Z Path to custom adapters : null 2022-02-18T20:14:56.3504871Z Other console options : null 2022-02-18T20:14:56.3505911Z Code coverage enabled : false 2022-02-18T20:14:56.3510216Z Diagnostics enabled : false 2022-02-18T20:14:56.3519771Z SystemVssConnection exists true 2022-02-18T20:14:56.3697972Z Run the tests locally using vstest.console.exe 2022-02-18T20:14:56.3698460Z ======================================================== 2022-02-18T20:14:56.5771570Z Source filter: D:\a\r1\a/_Test.AppiumTest/AppiumTesting/AppiumTest 2022-02-18T20:14:56.5973322Z ##[warning]No test sources found matching the given filter
1. Check whether the following latest packages are installed or not:
Microsoft.NET.Test.Sdk MSTest.TestAdapter MSTest.TestFramework NUnit3TestAdapter
2. As answered by Marina Liu , you can configure MSTest or the "Visual Studio Test" task in VSO to fail if there are warnings:
a. Add a PowerShell task after Visual Studio Test task.
b. Then get Visual Studio Test task build information by Timeline:
c. Search for Visual Studio Test task information by task name or task display name.
d. Fail the build result if VS test has the warning you specified.
References: How to Fix this C# issue No test matches the given testcase filter `FullyQualifiedName = , How can I configure MSTest to fail the unit test run on any warnings? and Run NUnit tests in Azure DevOps pipeline