How to Provide Login Credentials to an Automated Android Test

How to Provide Login Credentials to an Automated Android Test

21 May 2024 Stephan Petzl Leave a comment Tech-Help

When performing automated tests on your Android app, one common challenge is bypassing the login screen to test the app’s functionality post-login. This guide will walk you through the best practices to provide login credentials or skip the login step during your automated tests.

Using Firebase Test Lab

Firebase Test Lab offers a robust solution for running automated tests on your Android apps. Here’s how you can provide login credentials using Firebase Test Lab:

  1. Navigate to the Firebase Console and go to Test Lab.
  2. Select the appropriate dimensions for your test and click on Show Advanced Options.
  3. Look for the section labeled Test account credentials (Optional).
  4. Fill in the following details:
    • Enter username resource: The resource name of your username (email) EditText field, without the part. For example, if your EditText field is named, input edit_text_email.
    • Enter password resource: The resource name of your password EditText field, similarly without the part. For example, edit_text_password.
    • Enter username: The username or email you’d use for testing, e.g.,
    • Enter password: The password you’d use for testing, e.g., testTEST123.

The Robo test bot will then use these credentials to log in automatically. It might take a bit of time to figure out the correct button to click if you have multiple authentication options like ‘Sign in with Google’ or ‘Continue with Facebook’.

Additional Tips

If you provide a ‘Sign in with Google’ button, ensure you haven’t provided any other login credentials, as it will cause the login to fail. You can also use similar methods to fill in other EditText fields during your tests. For more detailed information, refer to the Test Lab documentation.

Programmatic Bypass for Login

Another approach is to configure an alternative APK that bypasses the login screen. This is particularly useful for alpha/beta testing. You can programmatically decide whether to require a login by consulting a special system property, "firebase.test.lab", which is set on Test Lab devices.

Enhancing Your Automated Tests with Repeato

For those looking to streamline their automated testing process, Repeato offers a powerful, no-code test automation tool for iOS and Android. Repeato allows you to create, run, and maintain automated tests quickly and efficiently. With its intuitive test recorder and AI-driven capabilities, Repeato simplifies the process of setting up and maintaining test scenarios, including those that involve complex login procedures.

Repeato’s scripting interface also enables advanced testers to automate intricate use cases, and its upcoming web testing support will further enhance your testing capabilities. For more information, visit our documentation or check out our blog.

Like this article? there’s more where that came from!