microsoft / microsoft/azure-devops-python-api

How to post Test Results to a test run.

Open
#415 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
684
Forks
218
Avg merge
8d 10h
Merged PRs (30d)
1

Description

Does anyone have sample code for posting Test Results to a Test Run? I have built a sample class which is working fine for many operations: get_projects, get_test_plans, get_test_case_list, get_test_runs, get_test_results, create_test_run. But when I try to post results to an existing or newly created test_run I get no errors, but only partial results. What I get is some data fields like: outcome, comment, owner, runBy comes through properly. But most fields, like testCaseTitle is a single title replicated for every test case, inside the test results there are no links to the Test Case or Test Project. I'm not sure if my test_results dictionary is incorrect or there are additional steps to creating a Test Run that I am missing. I have been trying to add 3 test case results like the one below, to a test run.

    test_results = [
            {
                "outcome": "passed",
                "errorMessage": "",
                "comment": "DevOps API Experiment",
                "dateStarted": "/Date(1648507431249)/",
                "dateCompleted": "/Date(1648507525480)/",
                "duration": 915770000,
                "testCaseId": 185,  # 185, 1071
                "configurationId": 6,
                "configurationName": "Windows 10",
                "testPointId": 128,  # 185-128, 1071-867
                "revision": 0,
                "state": "Completed",
                # "owner": "dd174dbe-01ab-6ee7-9aa8-a3ca22944639",  # User 2
                "owner": {"id": "6682ffe6-a175-640e-96a8-a3c8fdb046c7"},  # User 1
                # "runBy": "dd174dbe-01ab-6ee7-9aa8-a3ca22944639",
                "runBy": {"id": "6682ffe6-a175-640e-96a8-a3c8fdb046c7"},  # User 1
                "testCaseTitle": "Login Screen UX Elements",
                "testCaseArea": "",
                "dataRowCount": 0,
                "testCaseRevision": 1,
                "priority": 1,
                "planId": self.plan_id,
                "automatedTestName": "test_sample_azure_testplan.py",
            },

    response = self.harness.test_client.**add_test_results_to_test_run(test_results, self.project, self.run_id)**

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with add_test_results_to_test_run and the test_results payload shown in the issue, comparing how testCaseId, testPointId, planId, and the other fields are handled. Reproduce the call for the three test cases and verify that each result retains its distinct test case title and links to the expected Test Case and Test Project.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, python
Domain
api, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.