XCTestMetrics
欢迎使用 XCTestMetrics,这是一个命令行工具,可以提供有关您的项目测试的度量信息。
功能
- 获取有关您的项目测试的度量信息,例如失败次数、发生时间、不稳定性的百分比。
- 识别不稳定测试。
- 设置简单快捷。
要求
- Xcode 11
安装
Homebrew
$ brew tap serralvo/XCTestMetrics https://github.com/serralvo/XCTestMetrics.git
$ brew install serralvo/XCTestMetrics/xctestmetrics
用法
使用 XCTestMetrics 的步骤分为两步:第一步是注册每个测试结果,第二步是使用报告展示所有结果。
第一步
- 运行项目测试。
- 获取项目在
DerivedData
文件夹内的路径。- 可能会是这样的:
~/Library/Developer/Xcode/DerivedData/YourProject-gybqxixuerfernzjaklbxkwwstqj
- 可能会是这样的:
- 使用衍生数据路径调用
log
命令
$ xctestmetrics log path-to-derived-data
- 日志将被添加到
xctestmetrics-output
文件夹。 - 提交日志文件。
$ git add xctestmetrics-output/.
$ git commit -m "Adds xctestmetrics log"
第二步
Slack
- 您需要输入 webhook URL
- 可能是这样的:
https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
- 在此处检查如何创建 webhook。
- 可能是这样的:
- 运行
$ xctestmetrics report slack your-web-hook-url
- 就是这样!指标消息将被发送到 Slack。
HTML
- 运行
$ xctestmetrics report html
- 就是这样!报告文件(index.html)将存储在
xctestmetrics-report
文件夹中。
如果您希望在生成报告后删除 xctestmetrics-output
$ git rm -r xctestmetrics-output/
$ git add .
$ git commit -m "Removes xctestmetrics-output folder"
许可
XCTestMetrics 在 MIT 许可证 下发布。
致谢
制作