Tags

,

Support for mochitest-chrome tests on Android was recently improved and mochitest-chrome tests can now be seen on treeherder (the M(c) job) for all Firefox for Android builds. Most mochitest-chrome tests are desktop-specific or cross-platform; most Firefox for Android tests have been written for Robocop, our Robotium-based Android UI test framework.

I noticed that some Robocop tests were implemented almost entirely in Javascript and could easily be converted to mochitest-chrome, where tests would run much more efficiently. Bug 1184186 converted about 20 such Robocop tests to mochitest-chrome, reducing our Robocop load by about 30 minutes while increasing mochitest-chrome load by only about 3 minutes. (We save time by not starting and stopping the browser between mochitests, and not waiting around for state changes, as frequently required in UI tests.)

The “new” mochitest-chrome tests are all located in mobile/android/tests/browser/chrome and can also be run locally from mach. Just make sure you have:

  • a Firefox for Android build
  • an adb-connected device or emulator
  • MOZ_HOST_BIN set to a location for desktop xpcshell

Here is a screen recording showing the new tests in action: http://people.mozilla.org/~gbrown/mochichrome-screencast.mp4

Want to write your own mochitest-chrome test for Firefox for Android? Be sure to see https://developer.mozilla.org/en/docs/Mochitest#Writing_tests for general advice. If you are looking for an example, http://hg.mozilla.org/mozilla-central/file/3e51753a099f/mobile/android/tests/browser/chrome/test_app_constants.html is one of the simplest tests — a great place to start.

As always, be sure to see https://wiki.mozilla.org/Mobile/Fennec/Android/Testing for detailed information about running tests for Firefox for Android, and ping me on irc if you run into any trouble.

Advertisements