tfs netcore integration tests by testplan - wont find the testcases

Viewed 12

I have a netcore 6 unit test, which is linked to a tfs test case. In the build pipeline I build the netcore dll contains the test (netcore publish), and publish as an artifact (the bin\Release\net6.0\publish path). In the release pipeline I copy the artifact files to a temp folder, then apply a Visual Studio Test step on this folder, using Test Plan, selecting test suites containing my test case. Executing the test release pipeline I see the VS Test step found no tests (dunno what is 'test' - test case or test method):

Number of testcases discovered : 0

After this line I see

RunStatistics]This execution slice with id '8405', received '1' testcases to execute out of which '0' is discovered.

2022-09-07T13:15:26.6593846Z ##[error]The slice of type 'Execution' is 'Aborted' because of the error : Microsoft.VisualStudio.TestService.VstestAdapter.TestsNotFoundException: No test assemblies found on the test machine matching the source filter criteria or no tests discovered matching test filter criteria. Verify that test assemblies are present on the machine and test filter criteria is correct.

I use MSTest, the test can be discovered in VS2022 and can be executed correctly.

In the target directory )C:\temp\automata-tfs-tests\MyAPP-autotests) there exists my DLL (Test.AutoTest.dll), also a testhost.exe (if it is interested).

Anyone has any idea what should I do to fix the problem?

Got the following (full) log:

2022-09-07T14:16:02.0649513Z ##[section]Starting: Test run for Test plans 2022-09-07T14:16:02.0989252Z ============================================================================== 2022-09-07T14:16:02.0989349Z Task : Visual Studio Test 2022-09-07T14:16:02.0989396Z 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-09-07T14:16:02.0989460Z Version : 2.153.9 2022-09-07T14:16:02.0989504Z Author : Microsoft Corporation 2022-09-07T14:16:02.0989565Z Help : More information 2022-09-07T14:16:02.0989612Z ============================================================================== 2022-09-07T14:16:03.4309686Z SystemVssConnection exists true 2022-09-07T14:16:03.4310108Z SystemVssConnection exists true 2022-09-07T14:16:03.5947964Z SystemVssConnection exists true 2022-09-07T14:16:03.6776898Z In distributed testing flow 2022-09-07T14:16:03.6777031Z ====================================================== 2022-09-07T14:16:03.6777567Z Test selector : Test plan 2022-09-07T14:16:03.6777717Z Test plan Id : 5955 2022-09-07T14:16:03.6777832Z Test plan configuration Id : 55 2022-09-07T14:16:03.6777963Z Test suite Id selected: 5956 2022-09-07T14:16:03.6778021Z Test suite Id selected: 5959 2022-09-07T14:16:03.6778071Z Test suite Id selected: 5957 2022-09-07T14:16:03.6778205Z Search folder : C:\temp\automata-tfs-tests\MyAPP-autotests 2022-09-07T14:16:03.6779655Z VisualStudio version selected for test execution : latest 2022-09-07T14:16:03.6780047Z Attempting to find vstest.console from a visual studio installation. 2022-09-07T14:16:03.6959999Z Attempting to find vstest.console from a visual studio build tools installation. 2022-09-07T14:16:03.7387349Z Attempting to find vstest.console from a visual studio installation. 2022-09-07T14:16:03.7808933Z Attempting to find vstest.console from a visual studio build tools installation. 2022-09-07T14:16:03.8285853Z Distributed test execution, number of agents in job : 1 2022-09-07T14:16:03.8286311Z Number of test cases per batch : 100 2022-09-07T14:16:03.8307860Z Run in parallel : false 2022-09-07T14:16:03.8311511Z Run in isolation : false 2022-09-07T14:16:03.8312158Z Path to custom adapters : null 2022-09-07T14:16:03.8322692Z Other console options : /UseVsixExtensions:true /logger:trx 2022-09-07T14:16:03.8400643Z ##[warning]Other console options is not supported for this task configuration. This option will be ignored. 2022-09-07T14:16:03.8412667Z Code coverage enabled : false 2022-09-07T14:16:03.8412905Z Diagnostics enabled : false 2022-09-07T14:16:03.9119940Z ====================================================== 2022-09-07T14:16:03.9120805Z Source filter: *test.dll,!**\obj* 2022-09-07T14:16:04.0673691Z SystemVssConnection exists true 2022-09-07T14:16:04.0755317Z [command]C:\BuildAgent_work_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\2.153.9\Modules\DTAExecutionHost.exe --inputFile C:\BuildAgent_work_temp\input_9b793c20-2eb7-11ed-955e-6334f9e0a11a.json 2022-09-07T14:16:04.1535459Z ########################################################################## 2022-09-07T14:16:04.1535614Z DtaExecutionHost version 17.153.29006.1. 2022-09-07T14:16:05.1309152Z =========================================== 2022-09-07T14:16:05.1309447Z AgentName: BUILDAGENT-MyBu4-BUILDAGENT-MyBu4-24 2022-09-07T14:16:05.1309556Z ServiceUrl: http://tfs:8080/tfs/MyBu/ 2022-09-07T14:16:05.1309615Z TestPlatformVersion: 14.0.25420 2022-09-07T14:16:05.1309671Z EnvironmentUri: vstest://env/MyAPP/_apis/release/3/764/1759/1 2022-09-07T14:16:05.1309725Z QueryForTaskIntervalInMilliseconds: 3000 2022-09-07T14:16:05.1309821Z MaxQueryForTaskIntervalInMilliseconds: 10000 2022-09-07T14:16:05.1309901Z QueueNotFoundDelayTimeInMilliseconds: 3000 2022-09-07T14:16:05.1312343Z MaxQueueNotFoundDelayTimeInMilliseconds: 50000 2022-09-07T14:16:05.1312398Z =========================================== 2022-09-07T14:16:05.4078702Z TestExecutionHost.Execute: Registered TestAgent : 4034 : BUILDAGENT-MyBu4-BUILDAGENT-MyBu4-24 2022-09-07T14:16:05.4371941Z IsValidServiceResponse: Received None command..Service Workflow is not active 2022-09-07T14:16:05.4417823Z Updated Run Settings: 2022-09-07T14:16:05.4434862Z 2022-09-07T14:16:05.4435203Z 2022-09-07T14:16:05.4435273Z
C:\BuildAgent_work_temp\TR_46cf95a5-fd11-47f6-b503-3fa5ffad22f3 2022-09-07T14:16:05.4435335Z 2022-09-07T14:16:05.4435413Z 2022-09-07T14:16:05.6424857Z Creating run for selected test plan with following parameters 2022-09-07T14:16:05.6426439Z Test plan ID: 5955 2022-09-07T14:16:05.6427075Z Test suite ID: 5956,5959,5957 2022-09-07T14:16:05.6427697Z Test configuration ID: 55 2022-09-07T14:16:05.7792179Z No test cases for test suite 5956 2022-09-07T14:16:06.0575605Z No test cases for test suite 5957 2022-09-07T14:16:06.0577076Z test configuration mapping: 2022-09-07T14:16:06.0617024Z test settings id : 4895 2022-09-07T14:16:06.0617414Z Run title: MyAPP Auto Test Results 2022-09-07T14:16:06.0617774Z Build location: C:\temp\automata-tfs-tests\MyAPP-autotests 2022-09-07T14:16:06.0618880Z Build Id: 15656 2022-09-07T14:16:06.3113960Z Test run with Id 16287 associated 2022-09-07T14:16:16.4930577Z Received the command : Start 2022-09-07T14:16:16.4949323Z TestExecutionHost.ProcessCommand. Start Command handled 2022-09-07T14:16:16.5604339Z Slice with id = 8407, of type = 'Execution' received. 2022-09-07T14:16:16.7663381Z Count of test sources found: 1 2022-09-07T14:16:16.7763833Z ================================================================= 2022-09-07T14:16:16.7767368Z Discovering tests from sources 2022-09-07T14:16:23.4267264Z Number of testcases discovered : 0 2022-09-07T14:16:23.4269136Z Discovered tests 0 from sources 2022-09-07T14:16:23.4299463Z ================================================================= 2022-09-07T14:16:23.4344966Z [RunStatistics]This execution slice with id '8407', received '1' testcases to execute out of which '0' is discovered. 2022-09-07T14:16:23.4603621Z ##[error]The slice of type 'Execution' is 'Aborted' because of the error : Microsoft.VisualStudio.TestService.VstestAdapter.TestsNotFoundException: No test assemblies found on the test machine matching the source filter criteria or no tests discovered matching test filter criteria. Verify that test assemblies are present on the machine and test filter criteria is correct. 2022-09-07T14:16:23.4604497Z at Microsoft.VisualStudio.TestService.VstestAdapter.Execution.Run(ExecutionStateContext stateModdelContext, CancellationToken cancellationToken) 2022-09-07T14:16:23.4604635Z at Microsoft.VisualStudio.TestService.VstestAdapter.ExecutionAndPublish.Run(ExecutionStateContext stateModelContext, CancellationToken cancellationToken) 2022-09-07T14:16:37.5289010Z Received the command : Stop 2022-09-07T14:16:37.5289369Z TestExecutionHost.ProcessCommand. Stop Command handled 2022-09-07T14:16:37.5289442Z SliceFetch Aborted. Moving to the TestHostEnd phase 2022-09-07T14:16:37.6567079Z Please use this link to analyze the test run : http://tfs:8080/tfs/MyBu/MyAPP/_TestManagement/Runs#_a=resultQuery&runId=16287&queryPath=Recent+Run%2FRun16287 2022-09-07T14:16:37.6567848Z Test run '16287' is in 'Aborted' state with 'Total Tests' : 1 and 'Passed Tests' : 0. 2022-09-07T14:16:37.6593787Z ##[error]Test run is aborted. Logging details of the run logs. 2022-09-07T14:16:37.6621205Z ##[error]System.Exception: The test run was aborted, failing the task. 2022-09-07T14:16:37.7157795Z ########################################################################## 2022-09-07T14:16:37.8420313Z ##[section]Finishing: Test run for Test plans

1 Answers

Interestingly (this agent runs automata tests for another project without any problem) now I must add the "Visual Studio test platform installer" also and must change the setting *Test platform version" from "Latest" to "Installed by tools installer". And now it works.

Related