【发布时间】:2021-12-17 00:06:45
【问题描述】:
我已经设置了一个 Google Cloud 函数,它在一些 documentation 的帮助下向 Slack 报告 Firebase 测试实验室结果
但是,它目前只显示“PASSED”或“FAILED”,这没什么帮助。我想显示通过的测试总数,例如9/20 test cases passed.
我找不到任何详细说明如何执行此操作的文档。不可能吗?
这是我目前的功能:
exports.postTestResultsToSlack = functions.testLab
.testMatrix()
.onComplete(async testMatrix => {
if (testMatrix.clientInfo.details['testType'] != 'regression') {
// Not regression tests
return null;
}
const { testMatrixId, state, outcomeSummary, resultStorage } = testMatrix;
const colour = getSlackColour(outcomeSummary)
const title = `*Test Session: ${testMatrixId}*`;
const details = `7/10 passed (58%)`; // Replace hardcoded data here
const resultURL = resultStorage.resultsUrl
const slackResponse = await postToSlack(colour, title, details, resultURL);
functions.logger.log(JSON.stringify(slackResponse.data));
});
【问题讨论】:
-
嘿,所以您提供的屏幕截图是您想要从测试实验室检索的内容作为 Cloud Functions 的输出,这是您想要做的吗?
-
@ZeenathSN 是的,CI 系统运行自动化测试,完成后触发云功能,所以我想将数据从云功能发送到 Slack。
标签: json firebase google-cloud-platform cloud firebase-test-lab