Hi y'all,

We are now running Android unit tests and Android lint in automation:
Bug 1249166 [1].  You can see an example of this job at
https://treeherder.mozilla.org/#/jobs?repo=fx-team&revision=057c0e7cf189
-- it's the one labeled "Android 4.0 API15+ opt tc[Tier-2] (Unit)".  (I
have no
concrete plan to upgrade this to Tier 1 -- guidance appreciated.)

The new job is Android API 15 only and runs Gradle in automation.  It
produces a special --disable-compile-environment Fennec and Gradle
build, followed by two |mach gradle| commands (one for unit tests and
one for lint) [2].

Automation results
==================

The unit test and lint reports are uploaded to Task Cluster.  If you tap
"Unit", then "Taskcluster: Inspect Task" (in the bottom-left corner),
you should see a number of "Artifacts".  (Not related to artifact
builds, at least not directly.)  The two you want are (currently):

public/android/unittest/automationDebug/index.html
public/android/lint/lint-results-automationDebug.html

For example:

https://public-artifacts.taskcluster.net/UP3W7OHwQEGYNmHbPc5-pQ/0/public/android/unittest/automationDebug/index.html
https://public-artifacts.taskcluster.net/UP3W7OHwQEGYNmHbPc5-pQ/0/public/android/lint/lint-results-automationDebug.html

Local results
=============

To run the unit tests locally, run |mach gradle test|.  (The command in
automation is a subset of this.)  If the unit tests fail in automation,
this will burn the tree.  Since the job is Tier 2, you shouldn't be
backed out -- but you will be a Bad Citizen and should co-ordinate with
the Fennec team to greenify the tree.

During development, you can run these tests directly inside of Android
Studio.  Generally, this means right clicking a test class or test
method and choosing to "Run".

To run lint locally, run |mach gradle lint|.  It's not currently
possible to burn the tree by introducing additional lint issues.  Bug
1170283 [3] tracks burning down (fixing or ignoring) these lint issues,
so that we can make regressing lint a red tree.

Documentation
=============

There is none.  Android unit testing is very different to the existing
Robocop suite, and completely different from existing
Mochitest/Reftest/etc suites.  The Fennec team is slowly disseminating
Android unit testing knowledge throughout the team, but for now there's
nothing written down.  Look in
https://dxr.mozilla.org/mozilla-central/source/mobile/android/tests/background/junit4
for existing examples; read
http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Unit-testing
for configuration details; and dig into http://junit.org,
http://robolectric.org, and http://mockito.org for documentation on the
tools and frameworks we're using.

Acknowledgments
================

The Task Cluster team made this possible.  In particular, Dustin
J. Mitchell (:dustin) has been *absolutely invaluable* in getting this
running.  Jonas Finnemann Jensen (:jonasfj) also deserves recognition.
Jordan Lund (:jlund) provided valuable mozharness help and reviews.
Dave Townsend (:Mossop) led the way by showing how to get eslint running
in the tree.  Finally, Mike Comella (:mcomella) has been a champion for
Android Lint for a long time and has done most of the legwork to make
the Lint results valuable.

My thanks to you all.

Best,
Nick

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1249166
[2] https://hg.mozilla.org/integration/fx-team/rev/b7f1dac8306f#l1.11
[3] https://bugzilla.mozilla.org/show_bug.cgi?id=1170283
_______________________________________________
dev-builds mailing list
dev-builds@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-builds

Reply via email to