构建 运行 所有测试但它挂起 - Jenkins
Build run all the tests but it hangs - Jenkins
我已将 Jenkins 服务器配置为使用 Karma JS 构建 JS 项目,并以 xml 格式为 Jenkins 中的 JUnit 报告导出测试。测试是使用 QUnit 创建的。它运行良好,但现在发生了一些变化,构建运行了所有测试,但从未真正完成。
我的存储库位于本地网络上的一台计算机上,我使用 VisualSVN 并通过 https 访问它。
这是最后一次构建的输出(删除了大部分测试输出):
Started by user admin
[EnvInject] - Loading node environment variables.
Building in workspace /var/lib/jenkins/workspace/Furniture Constructor
Updating https://my_server_address/FurnitureConstructor/dev at revision '2016-10-27T11:01:17.530 +0200'
U karma.conf.js
At revision 240
[EnvInject] - Executing scripts and injecting environment variables after the SCM step.
[EnvInject] - Injecting as environment variables the properties content
$=PHANTOMJS_BIN=/usr/local/bin/phantomjs #or wherever PhantomJS happens to be installed
[EnvInject] - Variables injected successfully.
[Furniture Constructor] $ /bin/sh -xe /tmp/hudson7184342012546118229.sh
+ npm install
npm WARN package.json Furniture-Constructor@1.0.0 No description
npm WARN package.json Furniture-Constructor@1.0.0 No repository field.
npm WARN package.json Furniture-Constructor@1.0.0 No README data
npm WARN unmet dependency /var/lib/jenkins/workspace/Furniture Constructor/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/node_modules/tap/node_modules/nyc/node_modules/yargs/node_modules/cliui requires string-width@'^1.0.1' but will load
npm WARN unmet dependency undefined,
npm WARN unmet dependency which is version undefined
[Furniture Constructor] $ /bin/sh -xe /tmp/hudson2287766122018752412.sh
+ karma start
[33m27 10 2016 11:01:23.629:WARN [karma]: [39mNo captured browser, open http://localhost:9876/
[32m27 10 2016 11:01:23.654:INFO [karma]: [39mKarma v1.3.0 server started at http://localhost:9876/
[32m27 10 2016 11:01:23.655:INFO [launcher]: [39mLaunching browser PhantomJS with unlimited concurrency
[32m27 10 2016 11:01:23.750:INFO [launcher]: [39mStarting browser PhantomJS
[32m27 10 2016 11:01:24.400:INFO [PhantomJS 2.1.1 (Linux 0.0.0)]: [39mConnected on socket /#IAfAEFc2pEmxR12RAAAA with id 75925426
PhantomJS 2.1.1 (Linux 0.0.0) LOG: Object{millsPerPixel: 7, millsPerPixelForDepth: 16, cupboardWidth: 2500, cupboardHeight: 2500, cupboardDepth: 700, leftShelveWidth: 250, rightShelveWidth: 250, thickness: 30, floorChkBox: true, ceilingChkBox: true, leftShelveChkBox: true, rightShelveChkBox: true, rearChkBox: true, standLeftChkBox: true, standRightChkBox: true, standChkBox: true, shelveCssColor: '#3d6990', fullWidth: 3000, maxNumOfShelves: 25, maxNumOfInnerShelves: 25, maxNumOfBeams: 25}
PhantomJS 2.1.1 (Linux 0.0.0) LOG: Object{millsPerPixel: 7, millsPerPixelForDepth: 16, cupboardWidth: 2500, cupboardHeight: 2500, cupboardDepth: 700, leftShelveWidth: 250, rightShelveWidth: 250, thickness: 30, floorChkBox: true, ceilingChkBox: true, leftShelveChkBox: true, rightShelveChkBox: true, rearChkBox: true, standLeftChkBox: true, standRightChkBox: true, standChkBox: true, shelveCssColor: '#3d6990', fullWidth: 3000, maxNumOfShelves: 25, maxNumOfInnerShelves: 25, maxNumOfBeams: 25}
[1A[2KPhantomJS 2.1.1 (Linux 0.0.0): Executed 0 of 1070 SUCCESS (0 secs / 0 secs)
[1A[2KLOG: 'QUnit Parametrize Plugin Meta Tests'
PhantomJS 2.1.1 (Linux 0.0.0): Executed 0 of 1070 SUCCESS (0 secs / 0 secs)
[1A[2KPhantomJS 2.1.1 (Linux 0.0.0): Executed 1 of 1070 SUCCESS (0 secs / 0.003 secs)
[1A[2KLOG: 'QUnit Parametrize Plugin Meta Tests'
PhantomJS 2.1.1 (Linux 0.0.0): Executed 1 of 1070 SUCCESS (0 secs / 0.003 secs)
[1A[2KPhantomJS 2.1.1 (Linux 0.0.0): Executed 1069 of 1070 (46 FAILED) (0 secs / 4.852 secs)
[1A[2KLOG: 'QUnit Parametrize Plugin Meta Tests'
PhantomJS 2.1.1 (Linux 0.0.0): Executed 1069 of 1070 (46 FAILED) (0 secs / 4.852 secs)
[1A[2KPhantomJS 2.1.1 (Linux 0.0.0): Executed 1070 of 1070 (46 FAILED) (0 secs / 4.852 secs)
[1A[2KPhantomJS 2.1.1 (Linux 0.0.0): Executed 1070 of 1070 (46 FAILED) (5.106 secs / 4.852 secs)
我的 Karma 配置文件如下所示:
// Karma configuration
// Generated on Tue Oct 25 2016 13:03:04 GMT+0200 (CEST)
module.exports = function(config) {'use strict';
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['qunit'],
// list of files / patterns to load in the browser
files: [
'js/jquery.min.js',
'js/phaser.min.js',
'Testing/unit_tests/js/qunit-parameterize.js',
'Testing/unit_tests/js/tests/FrnConstrMock.js',
'js/utils/Utility.js',
'js/utils/Constants.js',
'js/utils/InnerSlotMatrixUtility.js',
'js/utils/GraphicsUtility.js',
'js/utils/ProcessDataUtility.js',
'js/utils/FrnConstrErrors.js',
'js/utils/FrnConstrMessages.js',
'js/State.js',
'js/Screens/Boot.js',
'js/UI/FrnConstrButton.js',
'js/UI/GoToScreen.js',
'js/UI/GoToUrl.js',
'js/Screens/Screen.js',
'js/Screens/Preloader.js',
'js/Screens/EnteriorScreen.js',
'js/Screens/ExteriorScreen.js',
'js/Screens/SendApplicationScreen.js',
'js/Screens/TestScreen.js',
'js/InitFrnConstrForm.js',
'Testing/unit_tests/js/tests/stubs/**/*.js',
'Testing/unit_tests/js/tests/*.js'
],
// list of files to exclude
exclude: [
'Testing/unit_tests/js/tests/**/FrnConstrStub.js'
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
//'Testing/unit_tests/js/**/*.js': ['coverage'],
//'js/**/*.js': ['coverage']
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress', 'junit'/*, 'coverage'*/],
// the default configuration
junitReporter: {
outputDir: 'test-reports', // results will be saved as $outputDir/$browserName.xml
outputFile: 'test-results.xml', // if included, results will be saved as $outputDir/$browserName/$outputFile
suite: '', // suite will become the package name attribute in xml testsuite element
useBrowserName: true, // add browser name to report and classes names
nameFormatter: undefined, // function (browser, result) to customize the name attribute in xml testcase element
classNameFormatter: undefined, // function (browser, result) to customize the classname attribute in xml testcase element
properties: {} // key value pair of properties to add to the <properties> section of the report
},
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: [/*'Chrome', 'Firefox', */'PhantomJS'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity,
// client configuration
client: {
clearContext: false,
qunit: {
showUI: true,
testTimeout: 5000,
filter: ''
}
}//,
// optionally, configure the reporter
/*coverageReporter: {
type : 'html',
dir : 'coverage/'
}*/
});
}
我认为 "coverage" 记者导致它挂起,所以我将其注释掉了。不,即使没有 "coverage" 记者,它仍然挂着。
我也找到了Thread Dump页面,里面有很多我不明白的信息。我必须找到一种方法来分享它,它超过 30000 个字符到 post。会有用吗?
知道构建挂起的原因吗?
这个
singleRun: false
导致 PhantomJS 挂起。将其设置为 true,以在测试结束时停止 PhantomJS。
您也可以为 karma 创建单独的配置文件,例如 karma.conf.local.js 和 运行 使用命令:
karma start karma.conf.local.js // useful for local testing, no Jenkins
这将避免需要一直为 Jenkins 编辑配置文件。
我已将 Jenkins 服务器配置为使用 Karma JS 构建 JS 项目,并以 xml 格式为 Jenkins 中的 JUnit 报告导出测试。测试是使用 QUnit 创建的。它运行良好,但现在发生了一些变化,构建运行了所有测试,但从未真正完成。 我的存储库位于本地网络上的一台计算机上,我使用 VisualSVN 并通过 https 访问它。
这是最后一次构建的输出(删除了大部分测试输出):
Started by user admin
[EnvInject] - Loading node environment variables.
Building in workspace /var/lib/jenkins/workspace/Furniture Constructor
Updating https://my_server_address/FurnitureConstructor/dev at revision '2016-10-27T11:01:17.530 +0200'
U karma.conf.js
At revision 240
[EnvInject] - Executing scripts and injecting environment variables after the SCM step.
[EnvInject] - Injecting as environment variables the properties content
$=PHANTOMJS_BIN=/usr/local/bin/phantomjs #or wherever PhantomJS happens to be installed
[EnvInject] - Variables injected successfully.
[Furniture Constructor] $ /bin/sh -xe /tmp/hudson7184342012546118229.sh
+ npm install
npm WARN package.json Furniture-Constructor@1.0.0 No description
npm WARN package.json Furniture-Constructor@1.0.0 No repository field.
npm WARN package.json Furniture-Constructor@1.0.0 No README data
npm WARN unmet dependency /var/lib/jenkins/workspace/Furniture Constructor/node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/node_modules/tap/node_modules/nyc/node_modules/yargs/node_modules/cliui requires string-width@'^1.0.1' but will load
npm WARN unmet dependency undefined,
npm WARN unmet dependency which is version undefined
[Furniture Constructor] $ /bin/sh -xe /tmp/hudson2287766122018752412.sh
+ karma start
[33m27 10 2016 11:01:23.629:WARN [karma]: [39mNo captured browser, open http://localhost:9876/
[32m27 10 2016 11:01:23.654:INFO [karma]: [39mKarma v1.3.0 server started at http://localhost:9876/
[32m27 10 2016 11:01:23.655:INFO [launcher]: [39mLaunching browser PhantomJS with unlimited concurrency
[32m27 10 2016 11:01:23.750:INFO [launcher]: [39mStarting browser PhantomJS
[32m27 10 2016 11:01:24.400:INFO [PhantomJS 2.1.1 (Linux 0.0.0)]: [39mConnected on socket /#IAfAEFc2pEmxR12RAAAA with id 75925426
PhantomJS 2.1.1 (Linux 0.0.0) LOG: Object{millsPerPixel: 7, millsPerPixelForDepth: 16, cupboardWidth: 2500, cupboardHeight: 2500, cupboardDepth: 700, leftShelveWidth: 250, rightShelveWidth: 250, thickness: 30, floorChkBox: true, ceilingChkBox: true, leftShelveChkBox: true, rightShelveChkBox: true, rearChkBox: true, standLeftChkBox: true, standRightChkBox: true, standChkBox: true, shelveCssColor: '#3d6990', fullWidth: 3000, maxNumOfShelves: 25, maxNumOfInnerShelves: 25, maxNumOfBeams: 25}
PhantomJS 2.1.1 (Linux 0.0.0) LOG: Object{millsPerPixel: 7, millsPerPixelForDepth: 16, cupboardWidth: 2500, cupboardHeight: 2500, cupboardDepth: 700, leftShelveWidth: 250, rightShelveWidth: 250, thickness: 30, floorChkBox: true, ceilingChkBox: true, leftShelveChkBox: true, rightShelveChkBox: true, rearChkBox: true, standLeftChkBox: true, standRightChkBox: true, standChkBox: true, shelveCssColor: '#3d6990', fullWidth: 3000, maxNumOfShelves: 25, maxNumOfInnerShelves: 25, maxNumOfBeams: 25}
[1A[2KPhantomJS 2.1.1 (Linux 0.0.0): Executed 0 of 1070 SUCCESS (0 secs / 0 secs)
[1A[2KLOG: 'QUnit Parametrize Plugin Meta Tests'
PhantomJS 2.1.1 (Linux 0.0.0): Executed 0 of 1070 SUCCESS (0 secs / 0 secs)
[1A[2KPhantomJS 2.1.1 (Linux 0.0.0): Executed 1 of 1070 SUCCESS (0 secs / 0.003 secs)
[1A[2KLOG: 'QUnit Parametrize Plugin Meta Tests'
PhantomJS 2.1.1 (Linux 0.0.0): Executed 1 of 1070 SUCCESS (0 secs / 0.003 secs)
[1A[2KPhantomJS 2.1.1 (Linux 0.0.0): Executed 1069 of 1070 (46 FAILED) (0 secs / 4.852 secs)
[1A[2KLOG: 'QUnit Parametrize Plugin Meta Tests'
PhantomJS 2.1.1 (Linux 0.0.0): Executed 1069 of 1070 (46 FAILED) (0 secs / 4.852 secs)
[1A[2KPhantomJS 2.1.1 (Linux 0.0.0): Executed 1070 of 1070 (46 FAILED) (0 secs / 4.852 secs)
[1A[2KPhantomJS 2.1.1 (Linux 0.0.0): Executed 1070 of 1070 (46 FAILED) (5.106 secs / 4.852 secs)
我的 Karma 配置文件如下所示:
// Karma configuration
// Generated on Tue Oct 25 2016 13:03:04 GMT+0200 (CEST)
module.exports = function(config) {'use strict';
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['qunit'],
// list of files / patterns to load in the browser
files: [
'js/jquery.min.js',
'js/phaser.min.js',
'Testing/unit_tests/js/qunit-parameterize.js',
'Testing/unit_tests/js/tests/FrnConstrMock.js',
'js/utils/Utility.js',
'js/utils/Constants.js',
'js/utils/InnerSlotMatrixUtility.js',
'js/utils/GraphicsUtility.js',
'js/utils/ProcessDataUtility.js',
'js/utils/FrnConstrErrors.js',
'js/utils/FrnConstrMessages.js',
'js/State.js',
'js/Screens/Boot.js',
'js/UI/FrnConstrButton.js',
'js/UI/GoToScreen.js',
'js/UI/GoToUrl.js',
'js/Screens/Screen.js',
'js/Screens/Preloader.js',
'js/Screens/EnteriorScreen.js',
'js/Screens/ExteriorScreen.js',
'js/Screens/SendApplicationScreen.js',
'js/Screens/TestScreen.js',
'js/InitFrnConstrForm.js',
'Testing/unit_tests/js/tests/stubs/**/*.js',
'Testing/unit_tests/js/tests/*.js'
],
// list of files to exclude
exclude: [
'Testing/unit_tests/js/tests/**/FrnConstrStub.js'
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
//'Testing/unit_tests/js/**/*.js': ['coverage'],
//'js/**/*.js': ['coverage']
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress', 'junit'/*, 'coverage'*/],
// the default configuration
junitReporter: {
outputDir: 'test-reports', // results will be saved as $outputDir/$browserName.xml
outputFile: 'test-results.xml', // if included, results will be saved as $outputDir/$browserName/$outputFile
suite: '', // suite will become the package name attribute in xml testsuite element
useBrowserName: true, // add browser name to report and classes names
nameFormatter: undefined, // function (browser, result) to customize the name attribute in xml testcase element
classNameFormatter: undefined, // function (browser, result) to customize the classname attribute in xml testcase element
properties: {} // key value pair of properties to add to the <properties> section of the report
},
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: [/*'Chrome', 'Firefox', */'PhantomJS'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity,
// client configuration
client: {
clearContext: false,
qunit: {
showUI: true,
testTimeout: 5000,
filter: ''
}
}//,
// optionally, configure the reporter
/*coverageReporter: {
type : 'html',
dir : 'coverage/'
}*/
});
}
我认为 "coverage" 记者导致它挂起,所以我将其注释掉了。不,即使没有 "coverage" 记者,它仍然挂着。
我也找到了Thread Dump页面,里面有很多我不明白的信息。我必须找到一种方法来分享它,它超过 30000 个字符到 post。会有用吗?
知道构建挂起的原因吗?
这个
singleRun: false
导致 PhantomJS 挂起。将其设置为 true,以在测试结束时停止 PhantomJS。
您也可以为 karma 创建单独的配置文件,例如 karma.conf.local.js 和 运行 使用命令:
karma start karma.conf.local.js // useful for local testing, no Jenkins
这将避免需要一直为 Jenkins 编辑配置文件。