如何使用 API 将组件添加到测试用例?

How to add component to a test case using API?

我使用 tcms_api

创建了一个测试用例
test_case = rpc_client.TestCase.create({
    'summary': 'My testing',
    'product': 2,
    'category': 2,
    'priority': 1,
    'is_automated': True,
    'text': 'my first test case',
    'case_status': 2,  # CONFIRMED
})

我想将组件添加到测试用例中,但在 API 文档中找不到示例或语法。我根据自己的猜测和更改日志中的更新尝试了以下操作:

rpc_client.TestCase.add_component(test_case['id'], [3, 6])

我收到以下错误。您能否建议如何构建组件查询的查询?谢谢。

xmlrpc.client.Fault:

Fault -32603: 'Internal error: Component matching query does not exist.'

来自documentation这个方法的签名是:

function:: XML-RPC TestCase.add_component(case_id, component_id)

文档告诉您 component_id 是一个整数,而不是列表。

^^^^ 擦,文档有点错误。

第二个参数为字符串,应为组件名称!