Skip to content

Commit a53c473

Browse files
committed
Crashlytics smoke test stubbs
1 parent c816404 commit a53c473

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

smoke-tests/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ buildscript {
2525
dependencies {
2626
classpath "com.android.tools.build:gradle:3.4.3"
2727
classpath "com.google.gms:google-services:4.3.0"
28+
classpath "com.google.firebase:firebase-crashlytics-gradle:2.7.0"
2829
}
2930
}
3031

@@ -70,6 +71,7 @@ dependencies {
7071
implementation "com.google.firebase:firebase-auth"
7172
implementation "com.google.firebase:firebase-common"
7273
implementation "com.google.firebase:firebase-config"
74+
implementation "com.google.firebase:firebase-crashlytics"
7375
implementation "com.google.firebase:firebase-database"
7476
implementation "com.google.firebase:firebase-dynamic-links"
7577
implementation "com.google.firebase:firebase-firestore"
@@ -101,3 +103,4 @@ clean.doLast {
101103
}
102104

103105
apply plugin: "com.google.gms.google-services"
106+
apply plugin: "com.google.firebase.crashlytics"
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Copyright 2021 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package com.google.firebase.testing;
16+
17+
import static com.google.common.truth.Truth.assertThat;
18+
19+
import com.google.firebase.crashlytics.FirebaseCrashlytics;
20+
21+
import androidx.test.runner.AndroidJUnit4;
22+
import org.junit.Test;
23+
import org.junit.runner.RunWith;
24+
25+
@RunWith(AndroidJUnit4.class)
26+
public final class CrashlyticsTest {
27+
28+
@Test
29+
public void setCustomKeys() {
30+
FirebaseCrashlytics.getInstance().setCustomKey("TestKey", "TestValue");
31+
32+
// TODO There's not a public API to confirm the values were properly set,
33+
// but they can be checked via reflection.
34+
35+
}
36+
37+
@Test
38+
public void log() {
39+
FirebaseCrashlytics.getInstance().log("This is a log message");
40+
41+
// TODO hook into the FirebaseAnalytics listener to confirm that the event is logged to analytics.
42+
}
43+
44+
@Test
45+
public void didCrashOnPreviousExecution() {
46+
assertThat(FirebaseCrashlytics.getInstance().didCrashOnPreviousExecution()).isFalse();
47+
}
48+
49+
}

smoke-tests/src/main/java/com/google/firebase/testing/TestSuite.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
@RunWith(Suite.class)
2626
@Suite.SuiteClasses({
2727
BuildOnlyTest.class,
28+
CrashlyticsTest.class,
2829
DatabaseTest.class,
2930
DynamicLinksTest.class,
3031
FirestoreTest.class,

0 commit comments

Comments
 (0)