-
Notifications
You must be signed in to change notification settings - Fork 2
Testing Guide
Please read carefully the following instructions to consider when writing tests, or code that will be tested. These guidelines emerged after fixing this issue. See also this pull request.
All UI tests should extend the TearDown
class, like so:
class MyTest : TearDown() {
When extending this class, state is automatically cleaned up between tests. If needed, you can override the tearDown
method but make sure to call its super-implementation.
Note that this concerns only UI tests. End to end tests should extend the EndToEndTest
class.
For tests calling FirestoreReferenceList.requestAll()
, it is crucial to make a static mock of Firebase.firestore
. Otherwise, the end to end tests will fail because the .requestAll
acts as a Firebase initialisation, preventing the end to end tests from reinitialising the Firebase instance with the local emulator.
Firebase’s AuthStateListeners persist between tests. In order to remove them between tests, any listener must be registered like so:
Firebase.auth.registerAuthStateListener { ... }
And not the previous .addAuthStateListener
.