构建运行所有测试,但它挂起 - 詹金斯

时间:2016-10-27 09:39:07

标签: jenkins continuous-integration karma-runner qunit hang

我已经将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/'
    }*/
  });
}

我认为&#34;覆盖范围&#34;记者导致它挂起所以我评论了它。不,即使没有&#34;覆盖&#34;它仍然悬挂记者。

我还找到了Thread Dump页面,它有很多我不明白的信息。我必须找到一种方法来分享它,它超过30000个字符来发布它。它会有用吗?

为什么构建会挂起的任何想法?

1 个答案:

答案 0 :(得分:1)

这个

singleRun: false

导致PhantomJS挂起。将其设置为true,以在测试结束时停止PhantomJS。

您还可以为karma创建单独的配置文件,例如karma.conf.local.js,并使用以下命令运行它:

karma start karma.conf.local.js // useful for local testing, no Jenkins

这样可以防止需要一直为Jenkins编辑配置文件。