title: Unit Testing with Firebase
body: <p>I am building an android app which uses Firebase as the back-end and an model, view, presenter architecture. However, the fact that Firebase is a cloud service complicates the automated testing in my android app. So far I have built most of the authentication system, but am unable to see how to implement unit tests for the Firebase code in my app. In terms of end to end testing I am also stuck.</p>
  
  <p>Since testing is fundamental to any android app and without it application developers can't be sure what they have implemented is functioning as expected, I can't really progress any further without automated tests.</p>
  
  <p>In conclusion, my question is:</p>
  
  <blockquote>
    <p>Generally, how do you implement Firebase automated testing in an android app?</p>
  </blockquote>
  
  <p><strong>EDIT:</strong></p>
  
  <p>As an example could someone unit test the following method?</p>
  
  <pre><code>public void addUser(final String name, final String birthday,
                          final String email, final String password) {
          Firebase mUsersNode = Constants.mRef.child("users");
          final Firebase mSingleUser = mUsersNode.child(name);
          mSingleUser.runTransaction(new Transaction.Handler() {
              @Override
              public Transaction.Result doTransaction(MutableData mutableData) {
  
                  mSingleUser.child("birthday").setValue(birthday);
                  mSingleUser.child("email").setValue(email);
                  mSingleUser.child("password").setValue(password);
                  return Transaction.success(mutableData);
              }
  
              @Override
              public void onComplete(FirebaseError firebaseError, boolean b, DataSnapshot dataSnapshot) {
                  if(firebaseError != null) {
                          mSignUpPresenter.addUserFail(firebaseError);
                      } else {
                          mSignUpPresenter.addUserComplete();
                  }
              }
          });
      }
  </code></pre>