microsoft / microsoft/azure-devops-python-api
update_test_results() is failing even after giving correct runid as well as test case id
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 684
- Fork
- 218
- Merge trung bình
- 8 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 1
Mô tả
Hi All,
- I am calling update_test_results() but geting below error Test result 1286862 does not exist in test run 8239298. Here i am passing correct run_id as well as test_case_id here is the code.
from azure.devops.connection import Connection
from msrest.authentication import BasicAuthentication
from azure.devops.exceptions import AzureDevOpsServiceError
from azure.devops.v7_0.test.models import TestCaseResult
organization_url = 'https://dev.azure.com/msazuredev'
personal_access_token = ''
project_name = 'AzureForOperatorsIndustry'
run_id = 8239298 # Replace with the actual run ID
test_case_id = 1286862 # Replace with the actual test case ID
outcome = 'Failed' # Replace with the desired outcome (e.g., 'Passed', 'Failed', 'Blocked')
Create a connection to Azure DevOps using PAT
credentials = BasicAuthentication('', personal_access_token)
connection = Connection(base_url=organization_url, creds=credentials)
Get the test client
test_client = connection.clients.get_test_client()
try:
# Check if the test result exists in the specified test run
existing_result = test_client.get_test_result_by_id(project=project_name, run_id=run_id, test_case_result_id=test_case_id)
# Create a list of TestCaseResult to specify the update details
results = [
TestCaseResult(id=test_case_id, state=outcome)
]
# Update the test results using the TestClient
updated_results = test_client.update_test_results(results, project=project_name, run_id=run_id)
# Print the updated results
for result in updated_results:
print(f"Updated Test Result - Test Case ID: {result.id}, Outcome: {result.state}")
except AzureDevOpsServiceError as e:
if "cannot be found" in str(e):
print(f"Test result {test_case_id} does not exist in test run {run_id}. Skipping update.")
else:
print(f"Error updating test results: {e}")
print(f"Details: {e.response.text}")
What is the problem in this
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách xem xét các entry point get_test_result_by_id() và update_test_results() của Azure DevOps TestClient, cùng với model TestCaseResult được sử dụng trong ví dụ. Tái hiện request bằng các định danh run và result được cung cấp, rồi so sánh các trường định danh mà API mong đợi với các giá trị được truyền vào. Công việc được xem là hoàn tất khi cách sử dụng các định danh và lỗi phát sinh được ghi lại rõ ràng, hoặc hành vi lỗi được xác nhận bằng một test tập trung.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- azure, python
- Lĩnh vực
- api
- Loại issue
- Lỗi
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 35/100