Closed
Bug 943703
Opened 12 years ago
Closed 12 years ago
Create helpers.HelperInitializer for UITests
Categories
(Firefox for Android Graveyard :: Testing, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
Firefox 29
People
(Reporter: mcomella, Assigned: isurae)
References
Details
(Whiteboard: [mentor=mcomella][lang=java])
Attachments
(1 file, 4 obsolete files)
Some classes import AssertionHelper statically which imports its init method. The access level on init should be changed to protected and a new initializer class should be added to the package to call its init method.
To be consistent it should call all of the helpers init methods.
Then UITest.initHelpers should call this new classes' init method instead.
Assignee | ||
Comment 1•12 years ago
|
||
Is this close to what you had in mind?
Attachment #8346679 -
Flags: review?(michael.l.comella)
Reporter | ||
Comment 2•12 years ago
|
||
Comment on attachment 8346679 [details] [diff] [review]
943703.patch
Review of attachment 8346679 [details] [diff] [review]:
-----------------------------------------------------------------
Exactly what I was thinking! Good work!
Just elaborate on that comment, fix those nits, and I'll give you that r+!
By the way, when you want to work on a bug, you should leave a comment to be assigned so that someone else doesn't start working on the bug while you're working on it.
::: mobile/android/base/tests/helpers/HelperInitializer.java
@@ +1,1 @@
> +/* This Source Code Form is subject to the terms of the Mozilla Public
nit: whitespace.
@@ +1,5 @@
> +/* This Source Code Form is subject to the terms of the Mozilla Public
> + * License, v. 2.0. If a copy of the MPL was not distributed with this
> + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
> +
> +package org.mozilla.gecko.tests.helpers;
nit: whitespace
@@ +6,5 @@
> +
> +import org.mozilla.gecko.tests.UITestContext;
> +
> +/**
> + * Helper that initializes the other helper classes.
Additionally explain why we're doing this this way (i.e. that we want to statically import AssertionHelper for assertions, but that means we import the init method too).
@@ +8,5 @@
> +
> +/**
> + * Helper that initializes the other helper classes.
> + */
> +
nit: rm newline.
Attachment #8346679 -
Flags: review?(michael.l.comella) → feedback+
Reporter | ||
Updated•12 years ago
|
Assignee: nobody → isurae
Assignee | ||
Comment 3•12 years ago
|
||
Can you explain the whitespace issue?
Reporter | ||
Comment 4•12 years ago
|
||
Sure. Many developers are bothered by any excess, missing, or inconsistent whitespace - this is in the form of newlines, spaces between various syntactic elements (e.g. `if (myVar == true){` as opposed to the common style `if (mVar == true) {`), and extra spaces at the end of a line.
In this case, I'm commenting about end of line whitespace. Honestly, it can be a bit over obsessive to care about these details but there are some (appropriately over-obsessive) reasons for it:
* File size: extra whitespace means more disk usage. When you add in thousands of developers checking in their changes, this can add up (though still is honestly fairly negligible)
* Version control: It's easy to add extra whitespace to a line you didn't mean to, which will change the blame commits to your name! Being diligent about removing whitespace means this shouldn't accidentally happen
* Ease of editing: Certain keyboard-centric editors (e.g. vim, emacs) will respond unpredictably to unseen whitespace so it's nice to respect those users
* (This one can be considered a stretch, but is my favorite anyway) Discipline: It's part of your coding style. If you can't maintain whitespace, how can you hope to maintain your if's, &&'s, and ||'s? By practicing a good and comprehensive coding style that specifically pays attention to details, you're more likely to stay on your toes and catch similarly minute details that could be flawed in your code's logic!
If you go into the review tool here on Bugzilla, you'll notice this space highlights in red. Many editors and source control systems can also be set to highlight (or automatically remove) these spaces too. We avoid automatically removing them because that could create a lot of source control blame churn. Linters will also often tell you about these details.
In reviews, they are often marked with "nit:" because they're very obsessive details that shouldn't always hold up an r+ (to save the reviewer some time for a second pass) but should probably be fixed anyway.
Status: NEW → ASSIGNED
Assignee | ||
Comment 5•12 years ago
|
||
Fixed issues from review.
Attachment #8346679 -
Attachment is obsolete: true
Attachment #8346740 -
Flags: review?(michael.l.comella)
Reporter | ||
Comment 6•12 years ago
|
||
Comment on attachment 8346740 [details] [diff] [review]
943703.patch
Review of attachment 8346740 [details] [diff] [review]:
-----------------------------------------------------------------
::: mobile/android/base/tests/helpers/HelperInitializer.java
@@ +7,5 @@
> +import org.mozilla.gecko.tests.UITestContext;
> +
> +/**
> + * AssertionHelper is statically imported in many places. Thus we want to make
> + * its init method hidden from clients. For consistently we initialize all the
nit: consistently -> consistency
Also, before, "For consistency...", I would add, "By calling init within the same package, we can make it protected and thus not imported." or something similar.
Attachment #8346740 -
Flags: review?(michael.l.comella) → feedback+
Assignee | ||
Comment 7•12 years ago
|
||
Fix comment.
Attachment #8346740 -
Attachment is obsolete: true
Attachment #8346754 -
Flags: review?(michael.l.comella)
Reporter | ||
Comment 8•12 years ago
|
||
Comment on attachment 8346754 [details] [diff] [review]
943703.patch
Review of attachment 8346754 [details] [diff] [review]:
-----------------------------------------------------------------
::: mobile/android/base/tests/helpers/HelperInitializer.java
@@ +8,5 @@
> +
> +/**
> + * AssertionHelper is statically imported in many places. Thus we want to make
> + * its init method hidden from clients. We initialize the remaining helper
> + * classes from here so that all the init methods can be hidden from clients.
Sorry I'm being so pedantic, but this still doesn't quite get the thought the idea I wanted to add. Essentially, I want to add *why* having this HelperInitializer allows us to hide the init method from those importing classes (i.e. package protection).
Also, the term "client" usually refers more to outside users, usually multiple, trying to obtain some resource from us. While this is true, it's a stretch. I see there's no real good word to replace it (maybe "importing classes" but that's icky), but worded correctly, I think you can avoid using one (e.g. "AssertionHelper is statically imported in many places and so we want to make its init method hidden outside of this package.").
I would r+ w/ just the top change though.
We can do this back and forth on IRC if you want to make it go a little faster.
Attachment #8346754 -
Flags: review?(michael.l.comella) → feedback+
Assignee | ||
Comment 9•12 years ago
|
||
/**
* AssertionHelper is statically imported in many places. Thus we want to hide
* its init method outside of this package. We initialize the remaining helper
* classes from here so that all the init methods are package protected.
*/
How is that?
Reporter | ||
Comment 10•12 years ago
|
||
lgtm! Put it in the patch! :)
Assignee | ||
Comment 11•12 years ago
|
||
Fixed comment.
Attachment #8347217 -
Flags: review?(michael.l.comella)
Reporter | ||
Comment 12•12 years ago
|
||
Comment on attachment 8347217 [details] [diff] [review]
943703.patch
Review of attachment 8347217 [details] [diff] [review]:
-----------------------------------------------------------------
lgtm! Thanks for you help!
Attachment #8347217 -
Flags: review?(michael.l.comella) → review+
Reporter | ||
Updated•12 years ago
|
Attachment #8346754 -
Attachment is obsolete: true
Reporter | ||
Updated•12 years ago
|
Keywords: checkin-needed
Comment 13•12 years ago
|
||
Patch fails to apply on m-c changeset c0f85061c7d3:
patching file mobile/android/base/tests/UITest.java
Hunk #2 FAILED at 115
1 out of 2 hunks FAILED -- saving rejects to file mobile/android/base/tests/UITest.java.rej
unable to find 'mobile/android/base/tests/helpers/GestureHelper.java' for patching
1 out of 1 hunks FAILED -- saving rejects to file mobile/android/base/tests/helpers/GestureHelper.java.rej
Please upload a rebased patch. Thanks!
Keywords: checkin-needed
Reporter | ||
Comment 14•12 years ago
|
||
Reporter | ||
Updated•12 years ago
|
Attachment #8347217 -
Attachment is obsolete: true
Reporter | ||
Updated•12 years ago
|
Assignee: isurae → michael.l.comella
Reporter | ||
Comment 15•12 years ago
|
||
Rebased patch and pushed: https://hg.mozilla.org/integration/fx-team/rev/96088a8ba738
Assignee: michael.l.comella → isurae
Comment 16•12 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 29
Updated•5 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•