Kaarel Purde
Kaarel Purde

Reputation: 469

Are Firebase analytics events sent when running Robolectric tests?

I am using Firebase Analytics in my Android project. I am also using Robolectric for tests.

When running Robolectric tests are Firebase events sent? During the tests the code does reach

FirebaseAnalytics.getInstance(context).logEvent(eventName, bundle);

but is it actually doing anything?

Upvotes: 0

Views: 346

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317968

Yes, it is doing something.

The app will be logging analytics events according to its configuration according to the google-services.json file that you used to build the app. This is a really good reason to separate your test builds from your production builds. The Firebase team recommends that you create different projects for each one of your test environments (e.g. dev, staging, prod) so that the information gathered in once project does not affected the others.

Take a look at this blog post to get a hold of how things work.

Upvotes: 1

Related Questions