Comments (4)
FWIW, I'm looking into this myself and will share my workaround once I get it working. Assuming it works as expected, I'll submit a PR.
from testrail-api.
On closer inspection, it actually looks like latest version of (hosted) TestRail has a problem with this API as well. I'll probably need to switch to update_case
until server side fix is ready. Then we can worry about client-side issue :)
from testrail-api.
So I played around with the request with a single-suite project and multi-suite project and the documentation is right, except for one point.
Suite ID is required even for projects in single suite mode. The suite_id belongs in the path, with the case_ids to update in the request body.
Effectively the method should be like this
def update_cases(self, suite_id: int, case_ids: List[int], **kwargs) -> dict:
"""
Updates multiple test cases with the same values, such as setting a set
of test cases to High priority. This does not support updating multiple
test cases with different values per test case.
Note: The online documentation is wrong. The suite_id is required in
single suite mode as well.
:param suite_id:
The ID of the suite
:case_ids: List[int]
The IDs of the test cases to update with the kwargs
:param kwargs:
:key title: str
The title of the test case
:key section_id: int
The ID of the section (requires TestRail 6.5.2 or later)
:key template_id: int
The ID of the template (requires TestRail 5.2 or later)
:key type_id: int
The ID of the case type
:key priority_id: int
The ID of the case priority
:key estimate: str
The estimate, e.g. "30s" or "1m 45s"
:key milestone_id: int
The ID of the milestone to link to the test case
:key refs: str
A comma-separated list of references/requirements
"""
kwargs.update({"case_ids": case_ids})
return self.s.post(endpoint=f"update_cases/{suite_id}", json=kwargs)
I'll work on a PR.
from testrail-api.
Just for confirmation via curl that suite id is required for update_cases.
Suite mode of the project (1 for single suite mode, 2 for single suite + baselines, 3 for multiple suites)
⇒ curl -H "Content-Type: application/json" -u "$TESTRAIL_USR:$TESTRAIL_PSW" https://*******/index.php\?/api/v2/get_project/77 | jq
{
"id": 77,
"name": "Testrail Training",
"announcement": "This project is used for testrail training.",
"show_announcement": true,
"is_completed": false,
"completed_on": null,
"suite_mode": 1,
"default_role_id": null,
"case_statuses_enabled": false,
"url": "https://*****/index.php?/projects/overview/77",
"users": [
....
],
"groups": []
}
⇒ curl -H "Content-Type: application/json" -u "$TESTRAIL_USR:$TESTRAIL_PSW" https://******/index.php\?/api/v2/get_suites/77 | jq
[
{
"id": 27561,
"name": "Master",
"description": "Test Suite Description\r\n",
"project_id": 77,
"is_master": true,
"is_baseline": false,
"is_completed": false,
"completed_on": null,
"url": "https://*******/index.php?/suites/view/27561"
}
]
⇒ curl -H "Content-Type: application/json" -u "$TESTRAIL_USR:$TESTRAIL_PSW" https://*********/index.php\?/api/v2/update_cases -d '{"custom_automation_bucket": [2,3], "case_ids": [4477220, 4477221]}'
{"error":"Field :suite_id is a required field."}%
⇒ curl -H "Content-Type: application/json" -u "$TESTRAIL_USR:$TESTRAIL_PSW" https://*********/index.php\?/api/v2/update_cases/27561 -d '{"custom_automation_bucket": [2,3], "case_ids": [4477220, 4477221]}' | jq
{
"updated_cases": [
{
"id": 4477220,
"title": "[Negative] Making requests with improper authorization header",
"section_id": 246871,
"template_id": 2,
"type_id": 7,
"priority_id": 1,
"milestone_id": null,
"refs": "GROW-2566,GROW-2219,GROW-2568",
"created_by": 196,
"created_on": 1666373401,
"updated_by": 196,
"updated_on": 1666631763,
"estimate": null,
"estimate_forecast": null,
"suite_id": 27561,
"display_order": 2,
"is_deleted": 0,
"case_assignedto_id": null,
"custom_automation_type": null,
"custom_automation_state": null,
"custom_approval_status": null,
"custom_automation_category": 1,
"custom_preconds": null,
"custom_steps_separated": [
....
],
"custom_mission": null,
"custom_goals": null,
"custom_automation_comments": null,
"comments": [],
"custom_system_domain": [
6
],
"custom_automation_bucket": [
2,
3
],
"custom_product_feature": [
12,
21
]
},
{
"id": 4477221,
"title": "[Positive] Making requests with correct authorization header",
"section_id": 246871,
"template_id": 2,
"type_id": 7,
"priority_id": 1,
"milestone_id": null,
"refs": "GROW-2566,GROW-2219,GROW-2568",
"created_by": 196,
"created_on": 1666373402,
"updated_by": 196,
"updated_on": 1666631763,
"estimate": null,
"estimate_forecast": null,
"suite_id": 27561,
"display_order": 3,
"is_deleted": 0,
"case_assignedto_id": null,
"custom_automation_type": null,
"custom_automation_state": null,
"custom_approval_status": null,
"custom_automation_category": 1,
"custom_preconds": null,
"custom_steps_separated": [
....
],
"custom_mission": null,
"custom_goals": null,
"custom_automation_comments": null,
"comments": [],
"custom_system_domain": [
6
],
"custom_automation_bucket": [
2,
3
],
"custom_product_feature": [
12,
21
]
}
]
}
from testrail-api.
Related Issues (20)
- Documentation error in .add_attachment_to_result() HOT 1
- is_completed in _category taking an int instead of bool, pytestrail.py takes bool instead of int HOT 4
- Add ability to pass project_id when requesting list of users
- add warnings.warn about limited write operations using HTTP only
- Custom fields of type 'Multi-select' don't appear in case metadata. HOT 1
- Support for new bulk_api endpoints with pagination HOT 6
- PYTEST_CURRENT_TEST KeyError during request HOT 1
- feature request: consider custom exceptions for api retry HOT 1
- update_run_in_plan_entry doesn't work
- Add support for Groups API methods
- Add support for Datasets API methods
- Add support for Roles API methods
- Add support for Variables API methods
- Add support for BDD methods
- request: full response object in status code exception
- [update required] update_cases does not accept project_id now in latest APIs, it should be removed HOT 4
- Safe adding/removing test cases to test runs HOT 1
- Issue with Plans.add_plan_entry HOT 2
- Runs _session.runs.add_run() for POST index.php?/api/v2/add_run/{project_id} not working as expected HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from testrail-api.