karma-runner / karma-runner/karma

ChromeHeadless was crashed,When Running large number of test cases parallely?

Open
#2,950 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

### We are Running more than 3400 cases parallely with chromheadless browser using karma-chrome-launcher. Our Project Configuration Sample is explained in below link,

https://sqa.stackexchange.com/questions/30048/how-to-merge-different-karma-coverage-html-reports-into-single-html-file

If we run the "gulp coverage" command, 21 threads were runs parallel. Here I Mentioning each thread as a single gulp task. Each gulp task has a karma configuration file. Each Karma configuration has set of spec files which was written in jasmine javascript.

If we run the test cases, our expected behavior is all should run.

### But the chromeheadless was hanged. It automatically Restarted.

![image](https://user-images.githubusercontent.com/23030514/37148029-f73c3ea6-22ee-11e8-888d-70bbb761e5a9.png)

### Environment Details

- Karma version (output of `2.0.0`):
- Relevant part of your `karma.config.js` file
karma.conf.js file:-

`module.exports = function (config) {

config.set({

browsers: ['Chrome', 'IE', 'Firefox', 'ChromeHeadless'],

frameworks: ['jquery-1.10.2', 'jasmine-jquery', 'jasmine'],

files: [

'js/**/**/Common/Common_four/*.spec.js',

'js/src/assets/scripts/jquery-1.10.2.min.js',

'js/src/assets/scripts/jquery.easing.1.3.min.js',

'js/src/scripts/ej.dashboardViewer.web.all.min.js',

'js/src/scripts/aes.js',

'js/src/scripts/new/one.js',

],

concurrency: Infinity,

browserDisconnectTolerance: 3,

browserNoActivityTimeout: 1000000,

browserDisconnectTimeout: 1000000,

captureTimeout: 1000000,

retryLimit: 5,

// test results reporter to use

// possible values: 'dots', 'progress'

// available reporters: https://npmjs.org/browse/keyword/karma-reporter

reporters: ['progress', 'htmlDetailed'],

// Karma html reporter configuration

htmlDetailed: {

splitResults: false,

dir: '../cireports/nunit/common',

fileName: 'TestResult.html',

autoReload: false

},

coverageReporter: {

type: "html",

check: {

each: {

statements: 0,

branches: 0,

functions: 0,

lines: 0

}

}

}

});

};
`
**Gulp sample task:-**

`gulp.task('one', function (done) {

return new Server({

configFile: __dirname + '/karma.conf.one.js',

action: 'run',

singleRun: true,

preprocessors: {

'js/src/scripts/**/*.js': ['coverage'] //' js/src/scripts**/*.js'

},

reporters: ['progress', 'htmlDetailed', 'coverage'],

coverageReporter: {

dir: '../cireports',

subdir: "reporters",

reporters: [

{ type: 'json', file: "one.json" }

]

},

customLaunchers: {

MyHeadlessChrome: {

base: 'ChromeHeadless',

flags: ['--disable-translate', '--disable-extensions', '--remote-debugging-port=9223', "--headless", "--disable-gpu", "--window-size=1228,1000", "--no-sandbox"],

},

},

browsers: ['MyHeadlessChrome']

}, done).start();
});
`

**Package.JSON File:-**

`{

"name": "gulp-karma",

"version": "1.0.0",

"scripts": {

"coverage": "concurrently \"gulp set_1\" \"gulp set_2\" \"gulp set_3\"",
},

"devDependencies": {

"clean-dir": "^1.0.3",

"concurrently": "^3.5.1",

"count-files": "^2.6.2",

"eslint-html-reporter": "^0.5.2",

"ghooks": "^2.0.2",

"gulp": "^3.9.1",

"gulp-csslint": "^1.0.0",

"gulp-eslint": "^2.1.0",

"gulp-jasmine": "^3.0.0",

"gulp-lesshint": "^4.0.0",

"gulp-shell": "^0.6.5",

"istanbul-combine": "^0.3.0",

"jasmine": "^3.0.0",

"jasmine-core": "^2.99.1",

"jasmine-jquery": "^2.1.1",

"jquery-1x": "^1.12.1",

"karma": "^2.0.0",

"karma-chrome-launcher": "^2.2.0",

"karma-coverage": "^1.1.1",

"karma-firefox-launcher": "^1.0.1",

"karma-html-detailed-reporter": "^1.1.21",

"karma-ie-launcher": "^1.0.0",

"karma-jasmine": "^1.1.1",

"karma-jasmine-jquery-2": "^0.1.1",

"karma-jquery": "^0.2.2",

"karma-safari-launcher": "^1.0.0"

},

}
`
In above, "gulp-set1" have 12 threads gulp tasks.

For Example:
"gulp-set1": "concurrently "gulp one" "gup two" "gulp three" "gulp four" "gulp five" "gulp six" "gulp seven" "gulp eight" "gulp nine" "gulp ten".

### Steps to reproduce the behaviour

1. If we run the gulp coverage we will face the above issue
.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.