func TestMain(m *testing.M) {
	flag.Parse()
	if testing.Short() {
		log.Println("Skipping messaging integration tests in short mode.")
		return
	}
	ctx := context.Background()
	app, err := internal.NewTestApp(ctx, nil)
	if err != nil {
		log.Fatalln(err)
	}
	client, err = app.Messaging(ctx)
	if err != nil {
		log.Fatalln(err)
	}
	os.Exit(m.Run())
}
Enable API before testing
https://console.developers.google.com/apis/library/fcm.googleapis.com
package messaging
import (
	"context"
	"errors"
	"flag"
	"fmt"
	"log"
	"os"
	"regexp"
	"testing"
	"firebase.google.com/go/v4/integration/internal"
	"firebase.google.com/go/v4/messaging"
)
const testRegistrationToken = "fGw0qy4TGgk:APA91bGtWGjuhp4WRhHXgbabIYp1jxEKI08ofj_v1bKhWAGJQ4e3a" +
	"rRCWzeTfHaLz83mBnDh0aPWB1AykXAVUUGl2h1wT4XI6XazWpvY7RBUSYfoxtqSWGIm2nvWh2BOP1YG501SsRoE"
var messageIDPattern = regexp.MustCompile("^projects/.*/messages/.*$")
var client *messaging.Client