How Do I Validate My Google Firebase Tests?

Google Firebase Test Lab is a cloud-based app-testing infrastructure. With one operation, you can test your Android or iOS app across a wide variety of devices and device configurations, and see the results-including logs, videos, and screenshots-in the Firebase console.

Firebase Test Lab runs Espresso and UI Automator 2.0 tests on Android apps, and XCTest tests on iOS apps. Write tests using one of those frameworks, then run them through the Firebase console or the gcloud command line interface.

Firebase Test Lab lets you run the following types of tests:

  • Instrumentation test: A test you write that allows you to drive the UI of your app with the actions you specify. An instrumentation test can also make explicit assertions about the state of your app to verify correct functionality using AndroidJUnitRunner APIs. Test Lab supports Espresso and UI Automator 2.0 instrumentation test frameworks.
  • Robo test: A test that analyses your app’s interface and then explores it automatically by simulating user activities.
  • Game loop test: A test that uses a “demo mode” to simulate player actions in game apps.

How do I validate the Visual UI in Multiple Devices?

Demo

Prerequisites

  • Java Installed
  • JAVA_HOME environment variable is set to the Java SDK path
  • Android Studio IDE

Installing the Android Studio

Now let’s install Android Studio / SDK so that you can run the test script on an emulator or real device. You could install the Android SDK only but then you have to do additional advanced steps to properly configure the Android environment on your computer. I highly recommend installing the Android Studio as it makes your life easier.

Download the Android Studio executable. Follow the steps below to install locally on your computer:

Run the Visual UI Test locally

2. Import the project into Android Studio

The Script

https://github.com/applitools/eyes-android-hello-world/blob/master/app/src/androidTest/java/com/applitools/helloworld/android/ExampleInstrumentedTest.java

Before we run the test on Firebase lets run it on local emulator.

  1. Configure a local device Emulator from the AVD Manager in your android studio
  2. Insert Your Applitools API KEY in the test
  3. Launch the SimpleTest () from the ExampleInstrumentedTest.java. This will launch the Instrumentation test in the emulator.

That’s pretty easy isn’t it? Applitools will now capture each screen where the eyes.CheckWindow() is called and create a baseline on the first run.

Once the test completes, you can analyze the test results on the Applitools dashboard.

Firebase

Step1: Navigate to https://firebase.google.com/ and click on sign in

Step2: Click on Go to Console, Navigates to the Console Dashboard

Step3: Create a Project, once you create a project, all good to explore the dashboard and see through all the features available here.

Step 4: Lets Add the Configurations in android studio to run the tests

  • Click on Run and select the edit configurations.
  • Click on the + button to create a new android launch/debug configuration based on templates.
  • Select the Android Instrumentation Tests > In the Module select app >
    Test as Class > com.applitools.helloworld.android.ExampleInstrumentedTest
  • Now in the Deployment Target Options select Firebase Test lab Device Matrix

Step 5: Sign in with Google Firebase account and click ok

Step 6: Re-open the edit configurations

Now you can see the configure settings for Matrix configuration and cloud project

Select your project and add one or more custom devices from list of 150. For now let’s add 2 devices, Platform Android 9.x, API Level 28 (pie), Locale, Orientation.

We will use these devices to run our Instrumentation test on Firebase.

That’s it we are all good to run our test on the Firebase

Click on Run Example Instrumented Test this will now execute you tests on the devices you have selected on Firebase.

Let’s Go back to The Test lab on Firebase and you can see your tests running over there Parallelly with visual comparison checks done on Applitools AI Platform.

Conclusion

For More Information

Originally published at https://applitools.com on September 1, 2020.

Deliver visually perfect web and mobile apps with AI-powered end-to-end visual testing & monitoring. Get started, free: http://bit.ly/ApplitoolsFree

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store