Mobile/Fennec/Android/Testing: Difference between revisions

no edit summary
No edit summary
Line 77: Line 77:
* If the MOZ_HOST_BIN environment variable points to a directory containing xpcshell, that directory will be used for host utilities; otherwise, mach will offer to download and setup host utilities for you.
* If the MOZ_HOST_BIN environment variable points to a directory containing xpcshell, that directory will be used for host utilities; otherwise, mach will offer to download and setup host utilities for you.


== Front-end-centric tests ==
== Front-end-centric test notes ==
(In the interest of removing duplication) For basic details & run instructions, see [[#Quick reference]].


== integration tests ==
=== JUnit4 tests ===
(Note mcomella 5/5/16: they don't all pass for me locally)
 
These jobs run on [http://robolectric.org/ Robolectric], which mocks various Android libraries so you can write integration tests as unit tests. [http://mockito.org/ Mockito] is also supported for mocking (see [http://mxr.mozilla.org/mozilla-central/source/mobile/android/tests/background/junit4/src/org/mozilla/gecko/dlc/TestVerifyAction.java TestVerifyAction for a sample]).
 
You can also run specific tests from the IDE by selecting the "Build Variants" menu (bottom left), changing "Test Artifact" to "Unit Tests", right-clicking on the test class you want to run, and selecting the "Run <test-class>" option.
 
=== integration tests ===
You can run specific tests locally in the IDE by selecting the "Build Variants" menu (bottom left), changing "Test Artifact" to "Android Instrumentation Tests", right-clicking on the test class you want to run, and selecting the "Run <test-class>" option.
You can run specific tests locally in the IDE by selecting the "Build Variants" menu (bottom left), changing "Test Artifact" to "Android Instrumentation Tests", right-clicking on the test class you want to run, and selecting the "Run <test-class>" option.


These do not run in automation so junit tests (via robolectric) or robocop tests (which are integration tests with a UI component) are generally preferred.
These do not run in automation so junit tests (via robolectric) or robocop tests (which are integration tests with a UI component) are generally preferred.


== robocop UI tests ==
=== robocop UI tests ===
[[Auto-tools/Projects/Robocop|General Robocop information]] and http://mxr.mozilla.org/mozilla-central/source/mobile/android/tests/browser/robocop/README.rst.
[[Auto-tools/Projects/Robocop|General Robocop information]] and http://mxr.mozilla.org/mozilla-central/source/mobile/android/tests/browser/robocop/README.rst.


Confirmed users
975

edits