iamchrismiller / grunt-casper

Run CasperJS Scripts/Functional Tests
Other
69 stars 38 forks source link

Support for running tests in parallel #14

Closed YukonSaint closed 10 years ago

YukonSaint commented 10 years ago

Hey it would be great to add support for testing in parallel to 1.1. Our tests run about twice as fast in parallel. I was able to hack it in tasks/casper.js with a couple lines of code:

(outside this.files.forEach block) var seriesOption = (opttions.parallel) ? '' : 'Series';

grunt.util.async['forEach' + seriesOption](file.src,function (srcFile, next) {

What would be the best way to incorporate this into grunt-casper? Should I contribute to 1.1? When is that going to be released? We are doing a pretty major project right now with a ton of developers, so updating grunt-casper is far superior to us than hacking into everyone's node_modules folder.

iamchrismiller commented 10 years ago

Hey Matt,

How are you intending on running the task?

I have started implementing a parallel task option with timing but want to make sure I cover your use case before pushing it to the 1.1 branch.

I.E.

casper : { options : { parallel : true, concurrency : 10 }, files : /* Hash / Array ? */ }

YukonSaint commented 10 years ago

Yeah something like that. Max concurrency is a good idea. Does it wait until one of the first 10 tests is done, then start test #11, etc.?

Here's what ours looks like (right now we have a bunch of component tests and one big golden path test that looks at navigation between components):

casper : { options : {

    test : true,

    includes: 'app/shared/test/setup.js',

parallel : true, }, {

files : "app/entertainment/*/.test.js }

One of the things we also wanted to look at is spinning up a separate node instance for each component test. That can probably happen down the line though when we have hundreds of them.

-- Matt Savino

(w) 310-964-4127 (c) 310-344-0889 IM: matt_savino_dtv@yahoo.com

From: Chris Miller notifications@github.com<mailto:notifications@github.com> Reply-To: iamchrismiller/grunt-casper reply@reply.github.com<mailto:reply@reply.github.com> Date: Tuesday, October 22, 2013 12:49 AM To: iamchrismiller/grunt-casper grunt-casper@noreply.github.com<mailto:grunt-casper@noreply.github.com> Cc: DIRECTV msavino@directv.com<mailto:msavino@directv.com> Subject: Re: [grunt-casper] Support for running tests in parallel (#14)

Hey Matt,

How are you intending on running the task?

I have started implementing a parallel task option with timing but want to make sure I cover your use case before pushing it to the 1.1 branch.

I.E.

casper : { options : { parallel : true, concurrency : 10 }, files : /* Hash / Array ? */ }

— Reply to this email directly or view it on GitHubhttps://github.com/iamchrismiller/grunt-casper/issues/14#issuecomment-26783265.

iamchrismiller commented 10 years ago

Straight From Async Docs :

The same as each only no more than "limit" iterators will be simultaneously running at any time.

Note that the items are not processed in batches, so there is no guarantee that the first "limit" iterator functions will complete before any others are started.

I am close to having this finished.. I will complete it tonight after work.

iamchrismiller commented 10 years ago

I pushed the fix to 1.1.. I was feeling ambitious. Let me know how it works for you.

Concurrency is maxed at 10 because of possible memory leaks in Node.