Error - NO test fiiles in vs task

Shyam Kumar 866 Reputation points
2025-05-26T11:00:07.01+00:00

I am seeing following error : in the vs test task which is the in the belwo template:

Running tests on assemblies: 
Microsoft (R) Test Execution Command Line Tool Version 16.11.0
Copyright (c) Microsoft Corporation.  All rights reserved.

No test source files were specified.


User's image

Please suggest

Azure DevOps
{count} votes

3 answers

Sort by: Most helpful
  1. Durga Reshma Malthi 5,310 Reputation points Microsoft External Staff Moderator
    2025-05-26T12:22:19.94+00:00

    Hi Diptesh Kumar

    Could you please check the following things:

    1. Your YAML template has this parameter: testAssemblyVer2: ${{ parameters.test_assembly_paths }}, Ensure it is correctly populated with valid test assemblies.
    2. Your YAML template includes: searchFolder: '${{ parameters.search_folder_for_vstest }}' Ensure the search folder has valid DLLs.
    3. Confirm that testSelector parameter is correctly set to testAssemblies or testPlan.

    Hope this helps!

    Please Let me know if you have any queries.

    1 person found this answer helpful.
    0 comments No comments

  2. Durga Reshma Malthi 5,310 Reputation points Microsoft External Staff Moderator
    2025-05-27T06:44:26.5166667+00:00

    Hi Diptesh Kumar

    The error "No test source files were specified" in your VSTest task likely means that the pipeline couldn't find any test assemblies to run.

    Yes, validation is essential because it ensures that the test execution process is correctly set up and that the pipeline can locate and run the expected test assemblies.

    As per your yaml file, please try the below steps:

    1. Ensure the correct path is provided for testAssemblyVer2 parameter. Example:
         parameters:
           test_assembly_paths: '**\bin\**\TestProject.dll'
      
    2. After the build step, check if test assemblies exist in the expected location (bin\Debug or bin\Release). You can add a step before VSTest to list the files:
         - script: dir /s /b $(Build.SourcesDirectory)
           displayName: 'List all files before test execution'
      
    3. The VSBuild step must compile unit test projects along with the main solution. If not, the test assemblies won’t exist. Modify the VSBuild task to include TestProject.sln explicitly:
         solution: 'TestProject.sln'
      
    4. Set explicitly for testSelector Value
         parameters:
           test_selector: 'testAssemblies'
      
    5. To Validate VSTest Task Execution, add detailed logging for VSTest execution by enabling verbose output:
         - task: VSTest@2
           inputs:
             testAssemblyVer2: '**\bin\**\TestProject.dll'
             testFilterCriteria: ''
             diagnosticsEnabled: true
           displayName: 'Run Tests with Detailed Logs'
      

    Hope this helps!

    Please Let me know if you have any queries.

    1 person found this answer helpful.
    0 comments No comments

  3. Shyam Kumar 866 Reputation points
    2025-05-27T04:25:00.18+00:00

    Hi Durga,

    Is it possible to validate this? Why is it important to perform validation? Could you please outline the steps required to validate it?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.