Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concurrency limit #8

Closed
wnr opened this issue Aug 25, 2013 · 12 comments
Closed

Concurrency limit #8

wnr opened this issue Aug 25, 2013 · 12 comments

Comments

@wnr
Copy link

wnr commented Aug 25, 2013

Is there any way of setting the concurrency (parallel) limit when testing with sauce? Because right now I'm unable to
test more than 3 browsers because I'm hitting my parallel cap of my open sauce account.

Have a look at https://github.com/axemclion/grunt-saucelabs which have the concurrency option.

@wnr
Copy link
Author

wnr commented Sep 2, 2013

@karma-runner will you have a look at this?

@rkistner
Copy link
Contributor

rkistner commented Sep 6, 2013

In my project I simply define multiple grunt tasks, and run them sequentially:

karma: {
        sauce1: {
            configFile: 'karma-sauce.conf.js',
            browsers: ['SL_IE_9', 'SL_IE_10']
        },
        sauce2: {
            configFile: 'karma-sauce.conf.js',
            browsers: ['SL_Chrome', 'SL_Safari']
        }
}

I also use a solution similar to this answer to always run the tests in all browsers, even if tests in the first one fail.

Of course, this only works when using singleRun: true.

My full config: Gruntfile.js and karma.conf.js.

@wnr
Copy link
Author

wnr commented Sep 8, 2013

@rkistner thanks alot! That should solve my problems. Smart to use multiple grunt tasks, didn't think of that :)

@wnr
Copy link
Author

wnr commented Sep 10, 2013

@rkistner do you also have a solution to mark browser runs passed/failed perhaps?

@rkistner
Copy link
Contributor

@wnr Unfotunately I don't. I'll log it as a separate issue.

@wnr
Copy link
Author

wnr commented Sep 11, 2013

@rkistner okay cool :)

@rkistner
Copy link
Contributor

This was fixed by karma-runner/karma#57, which was released in karma 0.11.0 (npm install karma@canary).

No need to specify the concurrency limit - the first browsers start running the tests immediately, and the next batch are queued and run as soon as the first ones have finished.

@wnr
Copy link
Author

wnr commented Sep 14, 2013

Oh okay, cool :) Thanks a bunch

@wnr wnr closed this as completed Oct 10, 2013
johnyanarella pushed a commit to CC-Archived/SWFService that referenced this issue Dec 3, 2013
@kimmobrunfeldt
Copy link

Thanks @rkistner for sharing your setup! I ended up doing the same thing but also in a way that separate karma tasks are created dynamically of given sauce lab browser setup: karma.conf.js, saucelabs-browsers.js, Gruntfile.js check also sauce task.

@sgarbesi
Copy link

@rkistner Expansion using caolan's async library.

    grunt.registerTask('tests', function() {
        var done = this.async();
        var series = [];
        var success = true;
        var tasks = {};

        Object.keys(grunt.config.data.karma).forEach(function(key) {
            if (key === 'options') {
                return;
            }

            var task = 'karma:' + key;
            tasks[task] = 0;

            series.push(function(callback) {
                grunt.util.spawn({
                    args: [task],
                    grunt: true,

                    opts: {
                        stdio: 'inherit'
                    }
                }, function(error, result, code) {
                    tasks[task] = code;

                    if (code !== 0) {
                        success = false;
                    }

                    callback();
                });
            });
        });

        async.parallelLimit(series, 1, function() {
            done(success);
        });
    });

@sgarbesi
Copy link

@kimmobrunfeldt This doesn't actually flag the browser as having failed in saucelabs. Did you manage to do anything further to get that to work?

@joscha
Copy link

joscha commented Oct 29, 2015

see #40 and karma-runner/karma#1646.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants