How to retrieve VsTest Test Plan test case id during Azure pipeline is running and use that in automation code - azure

Use Case:
Define a Test Plan, Test Suite and add test cases to it on ADO.
Link multiple (all) the tests on Test Plan to a single MsTest method.
Azure pipeline is setup to run the automation suite using the “Visual Studio Test” task and “Select tests using” option is set as “Test Plan”
I am searching for a solution on when Azure pipeline starts and VsTest task is running, can we get the Test case ID/Name (from ADO Test Plan) which is currently processed to run and provide that ID/Name to automation test method (as a parameter option to MsTest test). Using that test case ID, I will run few control statements in the code to perform desired tasks.
But, everything should happen runtime and the approach should be dynamic. Also, it should support parallel test execution.
Could you please share your thoughts.
TIA.
Akshay J.

Azure pipeline is setup to run the automation suite using the “Visual Studio Test” task and “Select tests using” option is set as “Test Plan”
According to your description, so Visual Studio Test task is configured like below.
In that case, you will know the id of test plan and id of test suite, so you could use Rest API: Test Suites - Get Test Cases to get all test cases in a suite including id and url, and then request this url will get fields.System.Title, that is the name of test case.
BTW, you could use API: Definitions - Get to get this release definition, in the response you will find the following VsTest task and its settings including id of test plan and id of test suite.

Related

Test Run Result steps and Test Run Result Summary Details but unable to find any API related

i am trying to fetch the attachments of the Test Run Result steps and Test Run Result Summary Details but unable to find any API related to that is i need the attchments for Test Run Result Steps and attachments id, for Test Run Result Summary
A test case describes the steps to take when you run a test. Test suites are groups of test cases, and a test plan is the collection of test suites that need to be run for a particular iteration or release. Test points are the pairings of test cases with test configurations that need to be run for the test plan. A test run consists of a set of test points. The results are the outcome of running the tests in the test run.
Check out the doc
https://learn.microsoft.com/en-us/rest/api/azure/devops/test/?view=azure-devops-rest-6.0
Work with test attachments programmatically using the REST APIs for Azure DevOps Services and Azure DevOps Server
and what you need specifically is at the website
https://learn.microsoft.com/en-us/rest/api/azure/devops/test/attachments/get-test-run-attachment-zip?view=azure-devops-rest-6.0

Azure Devops -Test Data displayed in pipeline is incorrect and is displaying data which i ran in my local esktop

I needed a small help. Whenever I run the pipeline, the data being displayed in testtab is incorrect and it displays the data which I ran on my local desktop rather than the job ran on Agent.
You can run tests in test tabs using different options. You can use any to solve your problem:
Automatically inferred test result: for some popular test runners' pipeline automatically infer the test output.
This is done with the help of describing the error logs generated during build operation.
Publish Test result task: Publishes test result to azure pipeline you choose the runner for tests execution available in
any formats.
Test execution tasks: Built -in test execution tasks such as visual studio test that automatically publish tests results to the pipeline
Azure Devops also provide other way to surface the test information You can use this.
Test analytics provide rich insights into test result over a period of time, identify problematic area in your test.
The dashboard provide track of your work's progress add widgets that surface test related information.
Requirement quality
Test result trend
Deployment status
Reference: https://learn.microsoft.com/en-us/azure/devops/pipelines/test/review-continuous-test-results-after-build?view=azure-devops

Azure DevOps: How can i connect Testcafe-tests to a testcase?

SO far i can run the pipeline manually and it runs my testcafe tests with the "node myTests.js" command.
my pipeline run
My file myTests.js looks like this:
myTests.js
I followed this tutorial: https://learn.microsoft.com/en-us/azure/devops/test/run-automated-tests-from-test-hub?view=azure-devops
I tried to associated an test to my Testplan via the REST API, i guess theres some problem. because i can name it whatever i want and it just runs it without errors:my testcase association
When i run a testcase it says it found an automated test and it runs it without errors, the VsTest Job runs but with a warning:
2021-05-18T09:16:32.7619103Z Source filter: *test.dll,!*TestAdapter.dll,!\obj*
2021-05-18T09:16:32.7879061Z ##[warning]No test sources found matching the given filter '*,!\obj**'
Any ideas what im doing wrong? I just want to run my pipeline or my test when im running a testcase in my testplans.
Azure DevOps: How can i connect Testcafe-tests to a testcase?
I am afraid you could not connect the Testcafe-tests to a testcase at this moment.
According to the document Run automated tests from test plans:
You will need:
A Team Build pipeline that generates builds containing the test
binaries.
That is the reason why you get the error No test sources found matching the given filter '*test.dll,!*TestAdapter.dll,!\obj*.
We could build and test the Testcafe-tests in the azure devops pipeline.
Please check the document Integrate TestCafe with Azure DevOps for some more details.

How to combine Azure Test Pland with Pipelines?

Currently I am trying to using Azure Test Plans to manage all test cases, but I just found how to build / generate manual test cases. I also make some research about Pipeline and I just write some "hello world" test scripts and using Pipeline to automatically test the code. My question is: How could I combine TestPlans with Pipeline to make the test in pipeline recordable? Thank you so much!
this is how the pipeline looks like
this is how the test code be checked
My question is: How could I combine TestPlans with Pipeline to make
the test in pipeline recordable?
I'm a bit confused about what the recordable mean in your question. To combine TestPlan with Pipeline, you should configure the Test Plan Settings. For example, set a build pipeline(build and generates the test binaries) and a release pipeline with test-related task in your Test Plan Settings.
The normal logic is:
A test plan containing your automated tests, which you have associated with automated test methods using Visual Studio 2017, or Visual Studio 2015 or earlier.
A Team Build pipeline that generates builds containing the test binaries.
The app to test. You can deploy the app as part of the build and release workflow and also use it for on-demand testing.
For more details please check Run automated tests from test plans.

Azure DevOps Test Plans - Synchronize JUnit test results in Runs with test cases on Tests Plan

In Azure DevOps, is there any way that I can synchronize the results in Runs with test cases in Test Plans automatically?
My process is:
Release pipeline is set up to trigger Jenkins build to run automated tests.
JUnit test results will be downloaded and published once the build is completed.
Tasks in automation run stage of pipeline.
The process works as expected. I can see the JUnit results in Runs section as the image below. However, the outcome of the test results in Runs (all failed) is not synchronized with test cases in Test Plans (still be active). Can I have the outcome of test cases in Test Plans updated every time the automation build is run and then JUnit XML results are published to Runs?
Results in Test Runs.
Test cases in Test Plans.
So fat is there any settings of Azure DevOps to make it done automatically or I have to update the test outcome in Test Plans manually?

Resources