Add Robocop Java harness for writing tests in Javascript

RESOLVED FIXED in Firefox 23

Status

()

defect
RESOLVED FIXED
6 years ago
5 years ago

People

(Reporter: nalexander, Assigned: nalexander)

Tracking

Trunk
Firefox 23
All
Android
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

A number of people have wanted to make it "easy to write Robocop tests", which has meant a number of things.  Recent consumers include Bug 866271, Bug 870371, and Bug 855146; recent implementers include Bug 777451.

On Bug 866271, I got feedback (from gbrown, mfinkle, and rnewman) on an approach for running xpcshell style tests from Robocop.  I've beefed that up and intend to land it as part of Bug 866271.  I intend to post to mobile-firefox-dev about this approach, and I want a ticket to refer to.  I will update this ticket when that post gets written.
(Assignee)

Updated

6 years ago
Assignee: nobody → nalexander
Blocks: 866271
Status: NEW → ASSIGNED
Try build with functionality exercising this patch at:

https://tbpl.mozilla.org/?tree=Try&rev=1b77c88798f2
Mercurial 2.0.2 seems to have a Mac OS X filename case bug.  Try

https://tbpl.mozilla.org/?tree=Try&rev=85dad1ab2455
Comment on attachment 748278 [details] [diff] [review]
Bug 870908 - Add Robocop Java harness for writing tests in Javascript. r=rnewman

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

Pervasive nit: it's "JavaScript", not "Javascript".

::: mobile/android/base/tests/BaseTest.java.in
@@ +219,5 @@
>          contentEventExpecter.unregisterListener();
>      }
>  
> +    /**
> +     * Load <code>url</code> using the awesome bar UI and sending key strokes.

Nit: "AwesomeBar".

::: mobile/android/base/tests/JavascriptTest.java.in
@@ +1,1 @@
> +#filter substitution

License.

@@ +114,5 @@
> +                if (Log.isLoggable(LOGTAG, Log.VERBOSE))
> +                    Log.v(LOGTAG, "Waiting for Robocop:Status");
> +                String data = expecter.blockForEventData();
> +                if (Log.isLoggable(LOGTAG, Log.VERBOSE))
> +                    Log.v(LOGTAG, "Got Robocop:Status with data '" + data + "'");

This method seems like a great place to enforce the {} rule.
Attachment #748278 - Flags: review?(rnewman) → review+
https://hg.mozilla.org/mozilla-central/rev/9295291746ca
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Whiteboard: [fixed in services]
Target Milestone: --- → Firefox 23

Comment 7

5 years ago
Nick:

Can you explain why you needed to change network.disable.ipc.security in this test?

  http://hg.mozilla.org/mozilla-central/diff/9295291746ca/mobile/android/base/tests/robocop_head.js#l1.61

If this is running in xpcshell then the runxpcshell command should already have set network.disable.ipc.security for you.  

I'm just trying to weed out invalid uses of the pref--generally code should not be setting it.

thanks.
Flags: needinfo?(nalexander)
(In reply to Jason Duell (:jduell) from comment #7)
> Nick:
> 
> Can you explain why you needed to change network.disable.ipc.security in
> this test?
> 
>  
> http://hg.mozilla.org/mozilla-central/diff/9295291746ca/mobile/android/base/
> tests/robocop_head.js#l1.61
> 
> If this is running in xpcshell then the runxpcshell command should already
> have set network.disable.ipc.security for you.  
> 
> I'm just trying to weed out invalid uses of the pref--generally code should
> not be setting it.

robocop_head.js is copy-pasta (I'm so sorry, but I couldn't deduce a better option at the time) straight from

http://hg.mozilla.org/mozilla-central/file/9295291746ca/testing/xpcshell/head.js#l55

So if that code has moved on, this should move on too.  But it looks like it hasn't:

http://hg.mozilla.org/mozilla-central/annotate/f93c0ef45597/testing/xpcshell/head.js#l92
Flags: needinfo?(nalexander)

Comment 9

5 years ago
Nick,

Oh, so robocop_head.js is used *instead* of head.js?  If that's so, then sure, we're good here.
(In reply to Jason Duell (:jduell) from comment #9)
> Nick,
> 
> Oh, so robocop_head.js is used *instead* of head.js?  If that's so, then
> sure, we're good here.

That's correct.  I would have liked to have shared them, but it seemed complicated: Robocop doesn't fully participate in the regular testing infrastructure.
You need to log in before you can comment on or make changes to this bug.