-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Runs _session.runs.add_run() for POST index.php?/api/v2/add_run/{project_id} not working as expected #92
Comments
So, add_run only has one positional argument, project_id, but suite_id is allowed as a keyword argument. Are you providing the suite ID in the add_run method call? |
Yes, I was providing the suite_id. With the suite id provided, the created
run is incorrect with:
- name of run is assigned the wrong name. it is assigned as the suite name
instead.
- untested_count is assigned the wrong value. It is assigned as the total
of the cases from the suite, which id is the suite_id
So, I removed the suite_id as the keyword argument, and the request failed
as documented. Then, I validated the issue in the POSTMAN as you can see in
the issue.
Thanks for the quick response and help.
…On Sun, Jul 30, 2023 at 8:00 AM Drew Ayling ***@***.***> wrote:
So, add_run only has one positional argument, project_id, but suite_id is
allowed as a keyword argument.
Are you providing the suite ID in the add_run method call?
—
Reply to this email directly, view it on GitHub
<#92 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADBMVIDQIR2DIG4L7L7RLTDXSZZJDANCNFSM6AAAAAA24ZS334>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Can you please provide a complete stack trace? |
Run completed, parsing output
tests\test_runs.py:93: testrail_api_category.py:1748: in add_run self = <testrail_api._testrail_api.TestRailAPI object at 0x000001A5B9880B20>
E testrail_api._exception.StatusCodeError: (400, 'Bad Request', 'https://hp-testrail.external.hp.com/index.php?/api/v2/add_run/466', b'{"error":"Field :suite_id is a required field."}') testrail_api_session.py:122: StatusCodeError Total number of tests expected to run: 1 |
just wondering if I need to provide more information or not. and appreciate if any update is available. thanks. |
I attempted to fix your formatting, and your request looks right, but now that I inspect the documentation it has this very weird type for "suite_id", I don't have access to a TestRail instance at the moment, so I cant verify what's correct.
|
I can help with that, just let me know what you want me to try on the testrail instance. |
Send ...
"suite_id": [65398],
... Please report the result |
Error message:
[2023-07-29 16:58:07,930][ERROR][_session]: Code: 400, reason: Bad Request url: https://hp-testrail.external.hp.com/index.php?/api/v2/add_run/466, content: b'{"error":"Field :suite_id is a required field."}'
The issue is the suite_id is not required parameter based on https://support.testrail.com/hc/en-us/articles/7077874763156-Runs#addrun, parameter. And the suite_id is provided in the payload. See the payload information next.
The payload is:
project id: 466
suite id: 65398
[2023-07-29 16:58:07,720][INFO ][tr_helper]: Create test run: TR Unit test 2023-07-29_16_58_07.715584-07_00 with payload {"suite_id": 65398, "name": "TR Unit test 2023-07-29_16_58_07.715584-07_00", "description": "Test run TR Unit test 2023-07-29_16_58_07.715584-07_00 with defined testcases", "include_all": false, "case_ids": [35076905, 35076906, 35076907, 35076908, 35076909, 35076910, 35076911, 35076912, 35076913, 35076914, 35076915, 35076916, 35076917, 35092638, 35092639, 35092640, 35092641, 35092642]}
The response is:
[2023-07-29 16:58:07,930][DEBUG][_session]: Response header: {'Date': 'Sat, 29 Jul 2023 23:58:07 GMT', 'Set-Cookie': 'tr_rememberme=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0, notificationbar=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/index, TS0104937c=01cc51d60f65ceaac8ccb9113c7ed2af29392e494590650e88f91f2816c687d5d132fa55b50c7630762e56a721ee5fd8b5fe216e01ac7687e66780f86fa40eaf200a3288354f4ee1b49b8a875c83435ec1f23f71ab; Path=/, TS01dcc28e=01cc51d60f0e31948020e5072e2a097b000496617890650e88f91f2816c687d5d132fa55b50c7630762e56a721ee5fd8b5fe216e01ac7687e66780f86fa40eaf200a3288356735f90794a3000489e519ab9613244003875726c359c8555bee4dc23636d04a; path=/index, TS98d9ab12029=08bf25d8b7ab2800d8d1f2bc61bed64729797a338741fd022c197bd5e265ad183568f1e636ead9949d74b04b7841d7a5; Max-Age=30; Path=/', 'Content-Length': '48', 'Connection': 'close', 'Content-Type': 'application/json; charset=utf-8', 'P3P': 'CP="{}"'}
FYI, the post request of add_run with the same endpoint and payload documented above works in the POSTMAN session.
![image](https://private-user-images.githubusercontent.com/12765856/257018646-588e19c7-2eb7-44fd-b1bd-e9b7e052c232.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkwMjI1NDUsIm5iZiI6MTcxOTAyMjI0NSwicGF0aCI6Ii8xMjc2NTg1Ni8yNTcwMTg2NDYtNTg4ZTE5YzctMmViNy00NGZkLWIxYmQtZTliN2UwNTJjMjMyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIyVDAyMTA0NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWFiZGUxM2VjY2Q4NWQ1MWYzOWJmN2FhYzQ2YWZlMTAyZjBhYTk4OTlhNTg4NjQzNWYyOGJmMTlkMjg0ZDJjODMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.vkOFaiJQL3sDSPmCD9LrQ__dfPNpJ04VaiLbIBG5Y7g)
The text was updated successfully, but these errors were encountered: