Adapt services' JUnit unit testing framework to Fennec

RESOLVED FIXED in Firefox 30

Status

()

Firefox for Android
General
RESOLVED FIXED
5 years ago
4 years ago

People

(Reporter: mcomella, Assigned: nalexander)

Tracking

Trunk
Firefox 30
All
Android
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(5 attachments)

The android background services team has one test suite for unit testing, which runs locally on desktop, and another test suite for integration testing, which runs on Android devices.

For mobile front-end, robocop serves the purpose of the integration test suite, however, the capabilities for unit testing are lacking.

Bug 709353 will integrate services' JUnit testing framework into the automated testing systems - at that point, we should piggy-back on these efforts and adapt it to work for Fennec.
(Assignee)

Comment 1

5 years ago
(In reply to Michael Comella (:mcomella) from comment #0)
> The android background services team has one test suite for unit testing,
> which runs locally on desktop, and another test suite for integration
> testing, which runs on Android devices.

To add some details: the unit testing suite is JUnit 4 and requires the Java runtime to execute; the integration testing suite is JUnit 3.
Note that bug 856614 is similar and perhaps should be duped.
Starting to track Fennec tests that would be 1/5 the size if implemented on JUnit:

Bug 834033
(Assignee)

Comment 4

5 years ago
Created attachment 8375799 [details] [diff] [review]
Land and build Fennec JUnit 3 tests. r=mfinkle

WIP for mcomella.
Attachment #8375799 - Flags: feedback?(michael.l.comella)
(Assignee)

Comment 5

5 years ago
Created attachment 8380225 [details] [diff] [review]
Pre: Make classes.dex depend on ANDROID_EXTRA_JARS. r=glandium

This has already been reviewed by glandium; will carry-forward the r+.
(Assignee)

Comment 6

5 years ago
Created attachment 8380226 [details] [diff] [review]
Part 1: Rename background.apk to background-junit3.apk. r=rnewman

This is a cautionary move: when uploaded to infrastructure,
background.apk will not look so bad; but browser.apk is likely to
confuse folks. (These files will be in the same directory as
fennec-*apk, and sort earlier than that file.)

I considered including "tests" in the name, but decided not to make a
long name even longer.

This also renames the Android package. This is purely cosmetic, since
the package has no consumers (infrastructure, mach, etc). But this looks
nicer in IDEs: the generated classes fit into the class hierarchy.
Attachment #8380226 - Flags: review?(rnewman)
(Assignee)

Comment 7

5 years ago
Created attachment 8380227 [details] [diff] [review]
Part 2: Land and build Fennec JUnit 3 tests. r=rnewman

The meat. Tested against my local device using Eclipse. Try build coming.
Attachment #8380227 - Flags: review?(rnewman)
(Assignee)

Comment 8

5 years ago
Created attachment 8380228 [details] [diff] [review]
Post: Add Eclipse project data to moz.build. r=rnewman
Attachment #8380228 - Flags: review?(rnewman)
Comment on attachment 8375799 [details] [diff] [review]
Land and build Fennec JUnit 3 tests. r=mfinkle

Assuming that I'm no longer needed here - reflag me if that's not the case.
Attachment #8375799 - Flags: feedback?(michael.l.comella)
Attachment #8380226 - Flags: review?(rnewman) → review+
Comment on attachment 8380227 [details] [diff] [review]
Part 2: Land and build Fennec JUnit 3 tests. r=rnewman

Review of attachment 8380227 [details] [diff] [review]:
-----------------------------------------------------------------

LGTM, but consider whether you want these tests to be 2- or 4-spaced. You've got them as 2-spaced right now.

::: mobile/android/tests/browser/junit3/Makefile.in
@@ +5,5 @@
> +ANDROID_APK_NAME := browser-junit3-debug
> +
> +ANDROID_EXTRA_JARS += \
> +	browser-junit3.jar \
> +  $(NULL)

Indenting.

::: mobile/android/tests/browser/junit3/src/harness/BrowserInstrumentationTestRunner.java
@@ +28,5 @@
> +    Log.d(LOG_TAG, "getAndroidTestRunner");
> +		AndroidTestRunner testRunner = super.getAndroidTestRunner();
> +		testRunner.addTestListener(new BrowserTestListener());
> +		return testRunner;
> +	}

Indenting.

::: mobile/android/tests/browser/junit3/src/harness/BrowserTestListener.java
@@ +14,5 @@
> + * <p>
> + * The idea is that, on infrastructure, we'll be able to use the same test
> + * parsing code for Browser JUnit 3 tests as we do for Robocop tests.
> + * <p>
> + * In future, that is!

Bug filed for this?
Attachment #8380227 - Flags: review?(rnewman) → review+
Comment on attachment 8380228 [details] [diff] [review]
Post: Add Eclipse project data to moz.build. r=rnewman

Review of attachment 8380228 [details] [diff] [review]:
-----------------------------------------------------------------

This is the most rubberstampy of rubberstamps.
Attachment #8380228 - Flags: review?(rnewman) → review+
(Assignee)

Comment 14

5 years ago
Looks like my moz.build AndroidEclipse data needed to be bumped:

https://hg.mozilla.org/integration/fx-team/rev/a7f45c95831d
(Assignee)

Comment 15

5 years ago
Looks like there are some pre-existing build dependency problems that this patch tickles:

https://hg.mozilla.org/integration/fx-team/rev/78e1e8346461
(Assignee)

Updated

4 years ago
Depends on: 979064
Duplicate of this bug: 856614
You need to log in before you can comment on or make changes to this bug.