Note: Creating and modifying test plans via third-party interfaces only supports Custom Test tasks. For other types, please configure them on the Cloud Testing page.
Add Normal Test Plan
Adding a test plan only supports Minium tasks
Request URL
https://minitest.weixin.qq.com/thirdapi/case_plan
Request Method
- POST
Parameters
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| token | Yes | string | Can be obtained from "My Token" in the dropdown menu next to the avatar in the top-right corner of the page. |
| group_en_id | Yes | string | Project English ID, which can be obtained from the Project Management/Product Management page. |
| test_plan_name | Yes | string | Test plan name. |
| test_plan_config | Yes | string | Refer to View Editing Instructions. Note that this field needs to be JSON serialized into a String (use json.dumps). |
Reference Code
import json
import requests
test_plan_config ={
'pkg_list': [
{
'case_list': ['test_*'],
'pkg': '__test_Home',
}
]
} # Can be adapted and modified based on your own Minium test cases
data = {
'token': 'xxx',
'group_en_id': 'xxx',
'test_plan_name': 'api custom Minium', # Test plan name
'test_plan_config': json.dumps(test_plan_config)
}
resp = requests.post(url='https://minitest.weixin.qq.com/thirdapi/case_plan', json=data)
Response Example
{
"data": {
"test_plan_id": xx,
},
"msg": "Test plan added successfully",
"rtn": 0,
"timestamp": 1614861228.1035924
}
Add New AI Custom Test Plan
Request URL
https://minitest.weixin.qq.com/thirdapi/ai_case_plan
Request Method
- POST
Parameters
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| token | Yes | string | You can obtain it from "My Token" in the dropdown menu to the right of the avatar in the top-right corner of the page. |
| group_en_id | Yes | string | The English ID of the project, which can be obtained on the Project Management/Product Management page. |
| test_plan_name | Yes | string | The name of the test plan. |
| case_ids | Yes | string | AI case IDs. These must be converted to a string using json.dumps, for example json.dumps([1]). |
| priority | No | string | Priority. The value must be one of 'P0', 'P1', 'P2', 'P3', 'P4', 'P5', or 'Others'. The default is P0. |
Reference Code
import requests
import json
data = {
'token': 'xxx',
'group_en_id': 'xxx',
'test_plan_name': 'ai_plan_api', # Test plan name
'case_ids': json.dumps([1,2,3]) # Replace with your own AI case IDs
}
resp = requests.post(url='https://minitest.weixin.qq.com/thirdapi/ai_case_plan', data=data)
Response Example
{
"data": {
"test_plan_id": xx,
},
"msg": "Added successfully",
"rtn": 0,
"timestamp": 1614861228.1035924
}
Query Test Plan
Query test plans. Only Monkey, Minium, or Record & Replay are supported.
Note: AI test plans belong to the Minium task type.
Request URL
https://minitest.weixin.qq.com/thirdapi/case_plan_list
Request Method
- GET
Parameters
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| token | Yes | string | Can be obtained from "My Token" in the dropdown menu next to the avatar in the top right corner of the page |
| group_en_id | Yes | string | Project English ID, available on the Project Management/Product Management page |
| test_type | Yes | int | Test type, 1: Monkey, 2: Minium, 3: Record and Replay |
| page_index | No | int | Page number, starting from 1, default is -1, indicating no pagination |
| page_size | No | int | Number of records returned per page, default is -1, indicating no pagination |
| keyword_in_name | No | string | Filter condition, characters contained in the test plan name |
Response Example
{
"data": [
{"case_detail": {}, "case_num": 2, "config": {}, "id": 0, "name": "", "test_type_info": "Minium"}
],
"msg": "OK",
"rtn": 0,
"timestamp": 1614937564.4042642
}
Modify Regular Test Plan
Only Minium test plans support modification, and when modifying a test plan, only the name and config fields can be changed.
Request URL
https://minitest.weixin.qq.com/thirdapi/case_plan
Request Method
- PUT
Parameters
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| token | Yes | string | Can be obtained from "My Token" in the dropdown menu next to the avatar in the top-right corner of the page |
| group_en_id | Yes | string | Project English ID, which can be obtained from the Project Management/Product Management page |
| test_plan_id | Yes | int | Test plan ID, which can be obtained via the query test plan API or from the ID column on the test plan page |
| test_plan_name | Yes | string | Test plan name |
| description | Yes | string | Refer to View Writing Instructions. Note that this field must be JSON serialized into a String before being passed in (use json.dumps()) |
Response Example
{
"msg": "Test plan modified successfully",
"rtn": 0,
"timestamp": 1614861228.1035924
}
Modify AI Custom Test Plan
This API can only modify the test plan for AI custom tests.
Request URL
https://minitest.weixin.qq.com/thirdapi/ai_case_plan
Request Method
- PUT
Parameters
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| token | Yes | string | Can be obtained from the "My Token" option in the dropdown menu next to the avatar in the top-right corner of the page |
| group_en_id | Yes | string | Project English ID, can be obtained from the Project Management/Product Management page |
| test_plan_id | No | int | Test plan ID, can be obtained via the query test plan API or from the ID column on the test plan page |
| test_plan_name | No | string | Test plan name |
| priority | No | string | Priority, only 'P0', 'P1', 'P2', 'P3', 'P4', 'P5', 'Others' are allowed |
| case_ids | No | string | AI case ID, must be converted to a string using json.dumps, e.g., json.dumps([1]) |
Reference Code
import requests
import json
data = {
'token': 'xxx',
'group_en_id': 'xxx',
'test_plan_id': 111, # Fill in the ID of the test plan to be modified
'test_plan_name': 'ai_plan_api_modify', # Test plan name
"case_ids": json.dumps([1,2]), # Fill in the IDs to be modified
}
resp = requests.put(url='https://minitest.weixin.qq.com/thirdapi/ai_case_plan', data=data)
Response Example
{
"msg": "Test plan modified successfully",
"data": {
"test_plan_id": 111,
},
"rtn": 0,
"timestamp": 1614861228.1035924
}
Delete Test Plan
Delete Test Plan
Request URL
https://minitest.weixin.qq.com/thirdapi/case_plan/delete
Request Method
- POST
Parameters
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| token | Yes | string | Can be obtained from "My Token" in the dropdown menu to the right of the avatar in the upper-right corner of the page |
| group_en_id | Yes | string | Project English ID, can be obtained from the Project Management/Product Management page |
| test_plan_id | Yes | int | Test plan ID, can be obtained via the Query Test Plan API or from the ID column on the test plan page |
Return Value
Check whether the rtn value in the return value is 0. It returns 0 only when the deletion is successful; otherwise, check the content of the msg field.