0

问题

我有一个为大型应用程序构建的非常大的测试套件。

该套件包括超过 20 个不同的 JS 规范文件,这些文件通过了对所述应用程序的数百次测试。它已经到了 Jasmine(通过 Grunt watch 运行)无法在不抛出“警告:未定义使用 --force 继续”消息的情况下运行所有​​测试的地步。

如果我运行 SpecRunner.html 文件,所有测试都会通过,并且即使 PhantomJS 说可以在那里找到更多信息,也没有其他信息。

一个人可以编写的测试数量是否有某种限制?

我正在使用 grunt v. ^0.4.5和 grunt-contrib-jasmin v. ~0.6.3

在此处输入图像描述

Gruntfile.js

module.exports = function(grunt) {
    // Project configuration. Can be any arbitrary data.
    // Things you might want to <% %> include in tasks.
    // These data can be accessed by grunt.config.<property>
    // Taksa are also configured here taking the format:
    // <taskname>: { <target1>: {}, <target2>: {} }

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        js: {
            lib: [
                'PriceAnalytics.Web/Scripts/lib/jquery/*.min.js', // jquery needs to be loaded before bootstrap
                'PriceAnalytics.Web/Scripts/lib/bootstrap/bootstrap.min.js',
                'PriceAnalytics.Web/Scripts/lib/knockout/knockout*.js',
                'PriceAnalytics.Web/Scripts/lib/underscore/underscore.min.js',
                'PriceAnalytics.Web/Scripts/lib/underscore/underscore.mixin.deepExtend.js',
                'PriceAnalytics.Web/Scripts/lib/globalize/globalize.js',
                'PriceAnalytics.Web/Scripts/lib/highcharts/highcharts.js'
            ],
            src: 'PriceAnalytics.Web/Scripts/src/**/*.js',
            spec: 'PriceAnalytics.Web.Test/spec/**/*.js'
        },

        jasmine: {
            src: '<%= js.src %>',
            options: {
                specs: '<%= js.spec %>',
                vendor: '<%= js.lib %>',
                //display: 'short',
                summary: true
                //keepRunner: true  could probably leverage this option so that we don't have to manually maintain teh specrunner script tags
            }
        },

        watch: {
            gruntfile: {
                files: '<%= jshint.gruntfile.src %>',
                tasks: ['jshint:gruntfile']
            },
            src_spec: {
                files: '<%= jshint.src_spec.src %>',
                tasks: ['jshint:src_spec', 'jasmine']
            }
        }
    });

    // Load the plugins
    grunt.loadNpmTasks('grunt-contrib-jasmine');
    grunt.loadNpmTasks('grunt-contrib-watch');

    // Default task(s)
    grunt.registerTask('default', ['jasmine']);
};
4

1 回答 1

0

原来我们的应用程序代码中有一个错误,它从 try/catch 中抛出错误,从而导致测试失败/不运行。

于 2015-03-16T18:54:53.663 回答