TestMatrix সমাপ্তিতে একটি ফাংশন ট্রিগার করুন
একটি নতুন ফাংশন তৈরি করুন যা TestMatrix ইভেন্ট হ্যান্ডলার functions.testLab.testMatrix().onComplete()
দিয়ে সম্পূর্ণ হলে ট্রিগার করে:
exports.sendEmailNotification = functions.testLab.testMatrix().onComplete((testMatrix) => {
// ...
});
পরীক্ষার অবস্থা এবং ফলাফল পরিচালনা করুন
আপনার ফাংশনের প্রতিটি এক্সিকিউশন একটি TestMatrix
পাস করে যার মধ্যে ম্যাট্রিক্সের চূড়ান্ত অবস্থা এবং সমস্যাগুলি বুঝতে সাহায্য করার জন্য বিশদ অন্তর্ভুক্ত থাকে।
exports.handleTestMatrixCompletion = functions.testLab.testMatrix().onComplete(testMatrix => {
const matrixId = testMatrix.testMatrixId;
switch (testMatrix.state) {
case 'FINISHED':
console.log(`TestMatrix ${matrixId} finished with outcome: ${testMatrix.outcomeSummary}`);
break;
case 'INVALID':
console.log(`TestMatrix ${matrixId} was marked as invalid: ${testMatrix.invalidMatrixDetails}`);
break;
default:
console.log(`TestMatrix ${matrixId} completed with state ${testMatrix.state}`);
}
return null;
});
ক্লায়েন্টের বিবরণ অ্যাক্সেস করুন
পরীক্ষার ম্যাট্রিক্স বিভিন্ন উৎস বা কর্মপ্রবাহ থেকে তৈরি করা যেতে পারে। তাই প্রায়শই এমন ফাংশন তৈরি করা বাঞ্ছনীয় যা পরীক্ষার উৎস বা অন্যান্য গুরুত্বপূর্ণ প্রেক্ষাপটের উপর ভিত্তি করে বিভিন্ন ক্রিয়া সম্পাদন করে। এটিতে সহায়তা করার জন্য, gcloud
আপনাকে একটি পরীক্ষা শুরু করার সময় ইচ্ছামত তথ্য পাস করার অনুমতি দেয় যা আপনার ফাংশনে পরে অ্যাক্সেস করা যেতে পারে। উদাহরণস্বরূপ:
gcloud beta firebase test android run \
--app=path/to/app.apk \
--client-details testType=pr,link=https://path/to/pull-request
উদাহরণ ফাংশন:
exports.notifyOnPullRequestFailure = functions.testLab.testMatrix().onComplete(testMatrix => {
if (testMatrix.clientInfo.details['testType'] != 'pr') {
// Not a pull request
return null;
}
if (testMatrix.state == 'FINISHED' && testMatrix.outcomeSummary == 'SUCCESS') {
// No failure
return null;
}
const link = testMatrix.clientInfo.details['link'];
let message = `Test Lab validation for pull request ${link} failed. `;
if (!!testMatrix.resultStorage.resultsUrl) {
message += `Test results available at ${testMatrix.resultStorage.resultsUrl}. `;
}
// Send notification here ...
});