how to run tests faster

17 views
Skip to first unread message

fschwiet

unread,
Nov 12, 2010, 12:45:04 AM11/12/10
to Jasmine
My tests are getting slow. I running them in firefox. Only a dozen
tests actually interact with a server, they are isolated to an iframe
(maybe 20% of overall time). I think a majority of the delay is from
DOM manipulation.

I'm wondering what is the fastest way to run my tests? I don't really
know Ruby, or Linux, I would learn either if its something I can
script to deploy to multiple machines easily.

500 tests are taking 10 seconds to run, on a coworkers machine they
took 30. It seems I need to break the tests up to make them runnable,
I'd rather not.

Rajan Agaskar

unread,
Nov 12, 2010, 8:48:46 AM11/12/10
to jasmi...@googlegroups.com
You're right about dom manipulation -- it tends to be extremely expensive. If you don't need a fixture, don't use it -- make sure you're inserting fixtures as close as possible to the tests that actually use them.

If you're testing stuff like drag/drop that causes the browser to re-render, you can sometimes save some time by making sure your fixture area is off-screen (pretty sure we already do this with the jasmine default runner).

if you're using waits, convert to using waitsFor, which will complete as soon as your latch function returns true.

Try using Safari or Chrome and see if you get a better rresult.

Run tests only on the suite level, then just do a full run when you check in.

Hope this helps!

Thanks!

Rajan


--
You received this message because you are subscribed to the Google Groups "Jasmine" group.
To post to this group, send email to jasmi...@googlegroups.com.
To unsubscribe from this group, send email to jasmine-js+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jasmine-js?hl=en.


Gregory Moeck

unread,
Nov 12, 2010, 9:55:43 AM11/12/10
to jasmi...@googlegroups.com
Using Chrome can significantly increase the speed that the tests get run. I have a suite that takes almost 5 seconds to run in Firefox, but only a little over 1 second in Chrome. The chrome error reporting is significantly inferior though, so I still will switch to run the specs in Firefox when it isn't giving me enough information.

Hope that helps,

Greg

Julien Wajsberg

unread,
Nov 12, 2010, 9:57:13 AM11/12/10
to jasmi...@googlegroups.com
maybe you can also try with the brand new firefox 4 beta 7 which is
much faster than 3.6 :)

fschwiet

unread,
Nov 12, 2010, 12:24:19 PM11/12/10
to Jasmine
Chrome is 3x faster, that does help. I haven't tried debugging with
it, I think its javascript console should work fine.

What do you mean running the tests at the suite level? When I
target a particular spec (clicking on a spec, navigating to
SpecRunner.html?spec=blah), it still seems to run all the tests. The
results shown are only for a particular test, but the runtime hasn't
really decreased and if I click the "show passed" checkbox it shows
results for all tests.

Isn't there a headless way to run the tests? I thought that might
be fastest, though maybe thats hard to work with during development
and only appropriate for a continuous integration server.



On Nov 12, 5:48 am, Rajan Agaskar <ra...@pivotallabs.com> wrote:
> You're right about dom manipulation -- it tends to be extremely expensive.
> If you don't need a fixture, don't use it -- make sure you're inserting
> fixtures as close as possible to the tests that actually use them.
>
> If you're testing stuff like drag/drop that causes the browser to re-render,
> you can sometimes save some time by making sure your fixture area is
> off-screen (pretty sure we already do this with the jasmine default runner).
>
> if you're using waits, convert to using waitsFor, which will complete as
> soon as your latch function returns true.
>
> Try using Safari or Chrome and see if you get a better rresult.
>
> Run tests only on the suite level, then just do a full run when you check
> in.
>
> Hope this helps!
>
> Thanks!
>
> Rajan
>
> On Thu, Nov 11, 2010 at 9:45 PM, fschwiet <fschw...@gmail.com> wrote:
> > My tests are getting slow.  I running them in firefox.  Only a dozen
> > tests actually interact with a server, they are isolated to an iframe
> > (maybe 20% of overall time).  I think a majority of the delay is from
> > DOM manipulation.
>
> > I'm wondering what is the fastest way to run my tests?  I don't really
> > know Ruby, or Linux, I would learn either if its something I can
> > script to deploy to multiple machines easily.
>
> > 500 tests are taking 10 seconds to run, on a coworkers machine they
> > took 30.  It seems I need to break the tests up to make them runnable,
> > I'd rather not.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Jasmine" group.
> > To post to this group, send email to jasmi...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > jasmine-js+...@googlegroups.com<jasmine-js%2Bunsu...@googlegroups.com>
> > .

Ross K

unread,
Nov 19, 2010, 7:46:08 AM11/19/10
to Jasmine
To run a focused test suite, I'll point the browser url for the
jasmine server to something like

http://localhost:8888/__suite__/categories/label.js

My js file at public/javascript/ (or whatever jasmine.yml is
configured to) is made available via /__suite__/

It'll even work with dir globs, so if I have a bunch of files in
categories/ I'd like to run, I use

http://localhost:8888/__suite__/**/*.js
Reply all
Reply to author
Forward
0 new messages