You have to send a message to browser process indicating that the test has succeeded (check out API here:
https://cs.chromium.org/chromium/src/extensions/common/api/test.json
In this case, I think you want to use chrome.test.listenForever:
var done = chrome.test.listenForever(chrome.alarms.onAlarm, function(alarm) {
// do stuf
if (alarmCount >=5) {
chrome.alarm.clearAllAlarms();
done(); // Afaik, this should remove the listener to onAlarm and send message to browser
// process that the test succeed (provided there are no other pending test callbacks
// (e.g. chrome.test.callbackPass that hasn;t yet been run))
}
});