No table to run automated tests (python/pytest) from test plans

Pawlowska Malgorzata 80 Reputation points
2025-11-24T12:57:14.26+00:00

Hi. I an trying to Run automated tests from test plan for my Python/pytest tests following the linked instruction.

I am encountering some errors: "No test sources found" & "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."


The automated pytest tests are associated with Test Cases from Test Plan (via functionalities in ADO Pipeline "Test" tab for Build Pipeline).

How I try to run the tests:

  1. In Test Plan > Execute clicking the "Run for web application" button.
    (The Build pipeline - in which tests were associated - is setup in Test Plan with latest build number. Release Pipeline with Stage is also configured).
  2. The Run is triggered but it is aborted.
  3. In Release Pipeline has the errors mentioned in first section (no test sources/assemblies).

The Release Pipeline configuration:

Artifacts from latest Build Pipelines + Test Stage (1 job + 2 steps):

Screenshot 2025-11-24 135300

Screenshot 2025-11-24 135433

  • enabled "Upload test attachments"

The files in test/build pipeline repository (+ code in src & pytest tests in tests folder):

requirements.txt

azure-devops==7.1.0b4
pytest-cov==7.0.0
python-dotenv==1.1.1

pytest.ini

[pytest]
pythonpath = ./src

addopts = 
    -vs
    --cov=src
    --cov-report xml
    --junit-xml=test-output.xml

azure-pipelines.yml

trigger:
- master

pool:
  vmImage: ubuntu-latest

steps:
- task: UsePythonVersion@0
  inputs:
    versionSpec: '3.12'

- script: |
    pip install --upgrade pip
    pip install -r requirements.txt
  displayName: 'Install dependencies'

- script: |
    pytest
  displayName: 'Run pytest tests'

- task: PublishTestResults@2
  condition: always()
  inputs:
    testResultsFiles: "**/test-*.xml"
  displayName: "Publish test results to pipeline"

- task: PublishCodeCoverageResults@2
  inputs:
    summaryFileLocation: '**/coverage.xml'
  displayName: "Publish code coverage results"

- task: PublishBuildArtifacts@1
  condition: always()
  inputs:
    PathtoPublish: '$(Build.SourcesDirectory)'
    ArtifactName: 'drop'      
    publishLocation: 'Container'
  displayName: 'Publish Build Artifact'
Azure DevOps

Answer accepted by question author
Rakesh Mishra 11,340 Reputation points Microsoft External Staff Moderator
2025-11-24T15:00:43.1233333+00:00

Hi @Pawlowska Malgorzata ,

Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.

1)Can VSTest/MSTest Be Used With Python/pytest?

No, VSTest/MSTest are designed for .NET-based automated tests (C#/VB/MS unit test frameworks).

You cannot directly run Python/pytest tests with VSTest/MSTest tasks.

However, Azure DevOps now supports Python frameworks in Test Plans (see below) via dedicated support for Pytest, JUnit, and other test adapters—not via VSTest/MSTest tasks.

 

2) How Can I Configure Pipelines for Direct Association Workflows?

Use the new Azure Test Plan task in your pipeline, which allows you to specify and link Pytest/Python tests directly to Test Cases in Azure Test Plans.

Make sure your pipeline generates JUnit XML output from your pytest run:

Then, use the Azure Test Plan task to link the results and test execution to your Test Plan/Case.

This approach works for both regular pipelines and release pipelines (the distinction is mostly historic; YAML pipelines are now standard).

 

3) How Can I Link Completed Pytest Test Runs With Test Cases and View Results in Test Plan?

After your pipeline runs and publishes results (JUnit XML), go to the Tests tab of your completed pipeline run in Azure DevOps.

Use the “Associate Test Case” option to map individual Pytest results to Azure Test Cases. This works for both normal and release pipelines.

Once mapped, results of future runs will be visible in the Test Case/Plan.

Note: Direct triggering of tests from Test Plan is supported for VSTest/MSTest, but for Python/Pytest it's a manual association, though Microsoft is actively expanding automatic support.

Make sure your test cases and automation mappings use the same names/metadata for consistent traceability.

Was this answer helpful?


1 additional answer

Sort by: Most helpful
  1. Pawlowska Malgorzata 80 Reputation points
    2025-12-03T13:56:46.4833333+00:00

    I found out that for now the only option to integrate Test Plans with Python/pytest automated tests is the usage of AzureTestPlan@0 (currently in Public Preview).

    Was this answer helpful?

    0 comments No comments

Your answer

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