FireUnit test adaption from Gears tests

2 views
Skip to first unread message

Kai Hendry

unread,
Jan 12, 2009, 9:17:01 AM1/12/09
to Firebug
Hi guys,

Just toying with the possibility of adapting Google Gears tests to
FireUnit. I don't like Gear's test harness as it seems far too quite
complicated. Also they don't seem to run one publicly.

So I put up: http://static.webvm.net/fireunit

And I am a little stuck. Can fireunit.runTests run/load remote
Javascript?

After executing testArguments I get this odd error message from
fireunit.js:989
"str.replace is not a function"

Just trying to discover how easy it is for JS unit tests to move
between different test frameworks.

Thanks for any pointers,

Jan Odvarko

unread,
Jan 12, 2009, 9:52:20 AM1/12/09
to Firebug
> After executing testArguments I get this odd error message from
> fireunit.js:989
> "str.replace is not a function"
The problem is that you are passing a function into fireunit.ok
instead of a string.

The second parameter 'x' should be a string for fireunit.ok method:
(fu_geo.html, line 39)
assertError = function(x) { fireunit.ok(false, x) };

But geolocation_test.js uses the assertError method as follows:
(geolocation_tests.js, e.g. line 49)
assertError(function() {
geolocation.getCurrentPosition();
});

Also line fu_geo.html, line 42 needs following fix:
fireunit.testDone();

See following examples (this is what we use for Firebug):
http://code.google.com/p/fbug/source/browse/tests/unit/start.html
http://code.google.com/p/fbug/source/browse/tests/unit/startNet.html

Honza

Kai Hendry

unread,
Jan 12, 2009, 11:27:38 AM1/12/09
to Firebug
Ah, thanks for the pointers!

I think I have proved to myself, that I can adapt the tests in the
meantime. :-)

Not sure yet how to handle startAsync and completeAsync in
testZeroTimeout within FireUnit.




Thanks again,

Jan Odvarko

unread,
Jan 12, 2009, 1:23:42 PM1/12/09
to Firebug
testZeroTimeout could be perhaps replaced by setTimeout but,
startAsync and completeAsync are not supported (at least no for now).
Every test is just finished with fireunit.testDone() method.
Honza

Kai Hendry

unread,
Jan 13, 2009, 6:47:20 AM1/13/09
to Firebug
On Jan 12, 2:52 pm, Jan Odvarko <odva...@gmail.com> wrote:
> See following examples (this is what we use for Firebug):http://code.google.com/p/fbug/source/browse/tests/unit/start.htmlhttp://code.google.com/p/fbug/source/browse/tests/unit/startNet.html

I svn checkout http://fbug.googlecode.com/svn/tests
http://static.webvm.net/fireunit/tests/unit/start.html

And made my own cutdown version here:
http://static.webvm.net/fireunit/tests2/start.html

And it doesn't work. What am I missing? =)

Jan Odvarko

unread,
Jan 13, 2009, 9:38:42 AM1/13/09
to Firebug
Do you see any error messages?

Try to load your start.html file using file:// protocol (directly from
local disk).
The page should start local HTTP server and automatically reload
itself using
http:// and launch all specified tests step by step.

Honza

On Jan 13, 12:47 pm, Kai Hendry <kai.hen...@gmail.com> wrote:
> On Jan 12, 2:52 pm, Jan Odvarko <odva...@gmail.com> wrote:
>
> > See following examples (this is what we use for Firebug):http://code.google.com/p/fbug/source/browse/tests/unit/start.htmlhttp...
>
> I svn checkouthttp://fbug.googlecode.com/svn/testshttp://static.webvm.net/fireunit/tests/unit/start.html

Kai Hendry

unread,
Jan 13, 2009, 11:48:12 AM1/13/09
to Firebug
On Jan 13, 2:38 pm, Jan Odvarko <odva...@gmail.com> wrote:
> Do you see any error messages?

Does it work for you?




When I type fireunit.forceHttp() on the console I get:

"win is undefined" at fireunit.js:140

Jan Odvarko

unread,
Jan 13, 2009, 12:20:13 PM1/13/09
to Firebug
I have just downloaded your files
from: http://static.webvm.net/fireunit/tests2/start.html

Created dir structure is as follows:

<root>
<console>
<commandline_files>
env.js
commandline.html
start.html

I have loaded the start.html file into browser (where Firebug and
Fireunit is installed) I.e.: file:///C:/.../start.html

All tests for the commandline.html has been launched, the Test panel
has been
activated at the end showing all (40) results.

> When I type fireunit.forceHttp() on the console I get:
If I load the commandline.html file (again using file:// protocol) and
put fireunit.forceHttp() into the Firebug's command line all tests
from the file are executed.

You can also try my latest test build here:
http://www.softwareishard.com/fireunit/fireunit-20082312.xpi

Honza

Kai Hendry

unread,
Jan 14, 2009, 12:34:41 PM1/14/09
to Firebug
I think I managed to get MozJSHTTP working. Once I copied the remote
files locally.

Fealt very odd! I think I'll serve my tests normally from a remote Web
server.



Thanks for your help!

Jan Odvarko

unread,
Jan 14, 2009, 12:39:44 PM1/14/09
to Firebug
> Fealt very odd! I think I'll serve my tests normally from a remote Web
> server.
Agree, this should be also possible. I am working on it.
Honza

Kai Hendry

unread,
Jan 15, 2009, 5:18:15 AM1/15/09
to Firebug
Thanks Jan,

Now I was hoping you could comment on a testing problem at work.

I need to automate Javascript tests as much as possible on mobile
devices, testing a plugin. Testing the plugin on the desktop (Firefox)
with FireUnit is fine.

Though I need to test also on really limited mobile platforms such as
Pocket IE on Windows Mobile (JQuery does not work). The only other
testing framework that actually seems to work on such devices is the
Gears one.

However it feels a little complex to me and it depends on some Gears
plugin functionality (I think) to actually work. So I've attempted to
strip down the assert libraries like so http://static.webvm.net/unit/foo.html
Which will stop processing on the first error currently.

So the idea I had is to tell testers to write in the Google Gears unit
test style. Kinda get it working with the Gears harness or my crappy
cut down new assert library http://static.webvm.net/unit/new-assert.js.
And when testing on desktop, I recommend using a FireUnit adaption
type technique.

Does that reasonable? Perhaps what I am really enquiring about is that
if you had any visions of a FireUnit lite or is that Qunit?

Thanks for your time!
Reply all
Reply to author
Forward
0 new messages