Geckoview-Junit Tests

The geckoview-junit tests are on-device Android junit tests written for geckoview.

By default, tests are from org.mozilla.geckoview.test.

These tests run on an Android device, controlled by a host (typically Linux) using mozdevice (adb). In automation, tests normally run in an Android emulator.

Running tests locally

If desired, connect an Android device to your computer, or start an emulator, and make sure your device is visible to adb:

$ adb devices
List of devices attached
emulator-5554    device

If no device is found, 'mach geckoview-junit' will offer to start an emulator.

Before running tests, install the androidTest apk on your device.

mozilla-central$ mach android archive-geckoview
...
mozilla-central$ ./mach gradle geckoview:installWithGeckoBinariesDebugAndroidTest
...
mozilla-central$ adb shell pm list packages org.mozilla.
package:org.mozilla.geckoview.test

To run all tests:

mozilla-central$ mach geckoview-junit

To run just one class of tests:

mozilla-central$ mach geckoview-junit <class>

To run just one test:

mozilla-central$ mach geckoview-junit <class>#<test>

Disabling one failing test

There is no manifest listing the geckoview junit tests. To disable a single test, edit the source code and insert JUnit's @Ignore annotation before the existing @Test annotation. For example:

import org.junit.Ignore
...

@RunWith(TestRunner.class)
public class TestSomeThings {
    @Ignore
    @Test
    public void testSomething() {
...

Running tests on try

To run these tests on try, use something like:

mach try fuzzy -q geckoview-junit --artifact

or

mach try -b do -p android-api-16 -u geckoview-junit --artifact

Currently, geckoview-junit is only run on android-api-16.

Contact information

geckoview-junit tests are maintained by :jchen and :gbrown. Bugs should be filed in Firefox for Android :: Testing.

Document Tags and Contributors

Contributors to this page: MattBrubeck, mkato, gbrown
Last updated by: MattBrubeck,