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.