There are several Android-specific test suites that run on the Firefox for Android codebase:

All of these suites require a functioning build of Firefox for Android — either a full build or an artifact build. All of the suites are configured by and invoked using Gradle.

Android-test

Runs Android-specific local unit tests.

These tests are local — they run on your development machine and do not require an Android device or Android emulator. Local unit tests are the fastest to develop and execute, but they can only test Java code; there's no connection to the Gecko rendering engine. Use these to test Java data structures and logic, and to ensure that basic Android integration works. They should always be preferred to on-device Robocop tests.

See https://developer.android.com/training/testing/unit-testing/local-unit-tests.html for more details.

Running android-test

To run android-test, first build Firefox for Android with your changes; then run

./mach android test

This will run the tests and report the results to stdout, as well as produce an HTML report. While developing, you can launch these tests from within Android Studio, which is the fastest way to iterate on code and tests.

Disabling one failing test

There is no manifest listing the Android local unit tests. To disable a single test, edit the source code and insert JUnit's @Ignore annotation before the existing @Test annotation. For example, to disable org.mozilla.gecko.permissions.testSuccessRunnableIsExecutedIfPermissionsAreGranted, add @Ignore as follows:

...

@RunWith(TestRunner.class)
public class TestPermissions {
    @Ignore
    @Test
    public void testSuccessRunnableIsExecutedIfPermissionsAreGranted() {
...

Contact information

android-test is currently owned by :sebastian and :nalexander. File tickets in the Firefox for Android product in Bugzilla.

Android-checkstyle

Verifies that the Java coding style is consistent throughout.

See http://checkstyle.sourceforge.net/index.html and https://docs.gradle.org/2.14/userguide/checkstyle_plugin.html for more details.

Running android-checkstyle

To run android-checkstyle, first build Firefox for Android with your changes; then run

./mach android checkstyle

This will run the tests and report the results to stdout, as well as produce an HTML report.

Disabling one failing test

In general, it's not sensible to allow Java code that doesn't observe the existing coding style; in this respect, this job is equivalent to the ESLint jobs that check the JavaScript coding style throughout the tree. However, the existing configuration can be tweaked and the set of files checked can be modified.

Contact information

android-checkstyle is currently owned by :mcomella and :nalexander. File tickets in the Firefox for Android product in Bugzilla.

android-findbugs

Ensures that the code avoids common Java coding errors.

Using this suite will allow the code to be analyzed to spot any design flaws or potential bugs. If an issue is found within the code, a warning will be identified and put into the correct category that the suite controls — this could be malicious, correctness, or just bad practice.

See http://findbugs.sourceforge.net/index.html and https://docs.gradle.org/2.14/userguide/findbugs_plugin.html for more details.

Running android-findbugs

To run android-findbugs, first build Firefox for Android with your changes; then run

./mach android findbugs

This will run the tests and report the results to stdout, as well as produce an HTML report.

Disabling one failing test

In general, it's not sensible to allow new Java code to land that findbugs detects issues with. However, the existing configuration can be tweaked and the set of files checked can be modified.

Contact information

android-checkstyle is currently owned by :mcomella and :nalexander. File tickets in the Firefox for Android product in Bugzilla.

android-lint

Ensure that the code avoids common Android coding errors.

Lint is a code scanning tool that identifies problems in the code regarding quality. It is a fast process that can be run on unexecuted code, and test cases are not needed for the process to be completed. Lint is a simple test that can assure you have a quality code.

See https://developer.android.com/studio/write/lint.html and http://tools.android.com/tips/lint for more details.

Running android-lint

To run android-lint, first build Firefox for Android with your changes; then run

./mach android lint

This will lint the code and report the results to stdout, as well as produce an HTML report. While developing, lint warnings should appear within Android Studio, although this is not infallible.

Disabling one failing test

In general, it's not sensible to allow new Java code to land that lint detects issues with. However, the existing configuration can be tweaked and some options can be modified.

Contact information

android-lint is currently owned by :sebastian and :nalexander. File tickets in the Firefox for Android product in Bugzilla.