使用cypress-testrail-accumulative-reporter如何仅生成回归用例测试运行
cypress-testrail-accumulative-reporter 仅生成回归用例测试运行的配置方案
你当前配置指定了suiteId为1,reporter默认会拉取该测试套件下的所有用例生成测试运行,因此会出现全量1000条用例都被包含的情况,按照以下方案调整配置即可实现仅包含回归用例的需求:
- 方案1:指定回归用例所在的Section ID
如果你的10条回归用例都归类在TestRail同一个Section(测试分组目录)下,直接在reporterOptions中添加sectionId配置即可,值为对应Section的数字ID,调整后配置示例:
"reporter": "cypress-testrail-accumulative-reporter", "reporterOptions": { "domain": "domain", "username": "name", "password": "pass", "projectId": 1, "suiteId": 1, "sectionId": 123, // 替换为你回归用例所属Section的实际ID "allowFailedScreenshotUpload": true, "runName": "Regression" }
- 方案2:通过用例自定义属性过滤
如果你给回归用例设置了专属的自定义属性(比如用例类型标记为「回归测试」),可以添加filters配置过滤对应属性的用例,以下为示例(需要替换为你TestRail中对应自定义字段的键名和回归用例对应的属性值):
"reporter": "cypress-testrail-accumulative-reporter", "reporterOptions": { "domain": "domain", "username": "name", "password": "pass", "projectId": 1, "suiteId": 1, "filters": { "custom_case_type": 2 // 示例:custom_case_type为TestRail用例类型字段的键名,2为回归用例类型对应的ID }, "allowFailedScreenshotUpload": true, "runName": "Regression" }
- 方案3:直接指定要包含的回归用例ID列表
如果回归用例ID固定,可直接通过includeCaseIds指定要包含的用例ID数组:
"reporter": "cypress-testrail-accumulative-reporter", "reporterOptions": { "domain": "domain", "username": "name", "password": "pass", "projectId": 1, "suiteId": 1, "includeCaseIds": [123,124,125,126,127,128,129,130,131,132], // 替换为你10条回归用例的实际ID "allowFailedScreenshotUpload": true, "runName": "Regression" }
注意:需要确保你执行的Cypress测试用例中,都通过
C+用例ID的格式标记了对应TestRail用例,比如it('C123 验证登录功能正常', () => {}),否则reporter无法正确匹配回填结果。
内容的提问来源于stack exchange,提问作者hanna
相关产品推荐
相关产品推荐

