flexperto / behat-testrail-reporter
将 behat 测试执行结果推送到 Testrail
1.1.0
2018-04-03 15:39 UTC
Requires
- php: ^7.0
- behat/behat: ~3.0
- nategood/httpful: >=v0.2.20
This package is not auto-updated.
Last update: 2024-09-29 22:41:22 UTC
README
启用并配置后,将向 Testrail 实例发送 API 请求,并更新指定的测试运行结果
系统要求
- php >= 7.0.1
- composer >= 1.0.0
- behat >= 3.0.0
使用方法
-
安装它
$ composer require flexperto/behat-testrail-reporter
-
在 Behat 配置中启用并配置上下文服务扩展
# behat.yml default: # ... extensions: flexperto\BehatTestrailReporter\TestrailReporterExtension: enabled: true baseUrl: https://mycompany.testrail.net/index.php?/api/v2 testidPrefix: test_rail_ username: erika.mustermann@mycompany.com apiKey: tesrailapikey.generatedforusernameabove runId: 1 customFields: custom_environment: '1'
enabled 字段默认为 true。但是,如果任何必需的字段(baseUrl、username、apiKey、runId)未设置,则插件不会启动。
如果未设置 testidPrefix,则默认为 test_rail_
customFields 可能很有用,如果您的 Testrail 实例配置为添加到测试结果的附加信息,则这些字段是必需的。在这种情况下,键是 Testrail 系统属性名称(而不是显示名称)。此外,值可能取决于属性类型。如果这是一个下拉列表,则所需值为条目 ID。
- 使用包含
testidPrefix和来自 Testrail 的 测试用例 ID 的注释标记您的场景。您可以使用一个或多个测试用例 ID。
@test_rail_99
Scenario: simple test
Given user has 3 apples
When user gives 1 apple to his friend
Then user has only 2 apples
@test_rail_101
@test_rail_102
Scenario Outline: extended test
Given user has <was> apples
When user gives 1 apple to his friend
Then user has only <is> apples
Examples:
|was|is |
| 3 | 2 |
| 4 | 3 |
-
在 Testrail 中创建一个测试运行,添加您要执行的测试用例
-
运行您的测试。
技术和其他细节
- 将提交评论以及结果,其中包含测试错误消息
- 对于场景概述,将只向 Testrail 提交一个测试结果。测试结果的状态将取决于概述中的最坏结果。但是,评论将包含概述中每个示例的测试结果摘要。
- 对于 Testrail 云安装,存在每秒请求数限制。为了在“几乎实时更新”和节省计算资源之间取得平衡,扩展将积累一批结果,并在单个功能完成后推送。
- 由于 Testrail API 不支持此功能且开发人员尚未计划支持自定义解决方案,因此目前不支持文件上传(例如截图)。