I'm working in an app that uses Firebase database. I also have to test it with espresso and jacoco, this is my test class:
@LargeTest
public class LoginActivityTest {
@Rule
public ActivityScenarioRule<LoginActivity> loginActivityTestRule = new ActivityScenarioRule<>(LoginActivity.class);
@Test
public void testRenderAll(){
onView(withId(R.id.tvUsername)).check(matches(isDisplayed()));
onView(withId(R.id.tvPassword)).check(matches(isDisplayed()));
onView(withId(R.id.btnEnter)).check(matches(isDisplayed()));
}
}
but when I run my test class, I get this error:
java.lang.IllegalStateException: Default FirebaseApp is not initialized in this
process com.skapsdevelopment.firebase.
Make sure to call FirebaseApp.initializeApp(Context) first.
And no matter what I do it keeps showing allways when I try to run the class.
I've tried
Firebase.initializeApp(this);Doesn't work- Inherent the OnCreate() function and call it there, also doesn't work
- Use FirebaseAuth also doesn't work
When I run just the test method it runs fine, but with the class, the error keeps showing. What can I do?
Aucun commentaire:
Enregistrer un commentaire