qase-tms/qase-python

Better error message when test is annotated with wrong ID

Opened this issue · 0 comments

When a test has qase.id() with an ID that doesn't exist in a repository:

@qase.id(42)
def test_example():
    pass

running the tests produces a confusing error message:

$ pytest

[Qase] TestOps: created test run https://app.qase.io/run/DEMO/dashboard/10
============================= test session starts ==============================
collecting ... collected 1 item

example_test.py::TestExample::test_example 
[Qase] Sending a result to test run 10...
[Qase] ⚠️  Error at sending results for run 10: (404)
Reason: Not Found
HTTP response headers: HTTPHeaderDict({'Date': 'Thu, 23 May 2024 12:28:22 GMT', 'Content-Type': 'application/json', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Cache-Control': 'no-cache, private', 'X-RateLimit-Limit': '1500', 'X-RateLimit-Remaining': '1497', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'})
HTTP response body: {"status":false,"errorMessage":"Test case not found"}

Instead, it should be something like


[Qase] Sending a result to test run 10...
[Qase] ⚠️  Error at sending results for run 10: (404)

Reason: Case with ID 42 not found in DEMO repository (from test example_test.py::TestExample::test_example)

Reason: example_test.py::TestExample::test_example@qase.id(42) not found in https://app.qase.io/project/DEMO