1

分度器構成ファイルからスイートに記載されているすべての仕様のリストが必要であり、どのように失敗したかを知っています。これを達成する方法はありますか?このためのカスタム ジャスミン レポートを作成しています。

ありがとう!

4

1 に答える 1

0

カスタム jasmine レポーターで次のようなものを使用します。

var suiteResults = [];
var currentSpecName;
var currentSpecStatus;

specStarted: function(spec) {
    // get the name of the spec
    console.log('Starting Spec: ' + spec.fullName);
    currentSpecName = spec.fullName;
};

specDone: function(result) {
    var passCount = result.passedExpectations.length;
    var failCount = result.failedExpectations.length;
    var expectationCount = passCount + failCount;

    var specIsDisabled = result.status === 'disabled';
    var specIsPending = result.status === 'pending';
    var specIsInvalid = !specIsDisabled && !specIsPending && expectationCount === 0;
    var specPassed = !specIsDisabled && !specIsPending && !specIsInvalid && failCount === 0;
    var specFailed = !specIsDisabled && !specIsPending && !specIsInvalid && !specPassed;    

    currentSpecStatus = specFailed ? 'FAILED' : 'PASSED';
    console.log('Status: ' + currentSpecStatus);
    suiteResults.push({specName: currentSpecName, specStatus: currentSpecStatus});
};

suiteDone: function() {
    var specCount = suiteResults.length;
    var failCount = suiteResults.filter(function(result) {
        return result.specStatus === 'FAILED';
    }).length;
    console.log(specCount + ' specs, ' + failCount + ' failures');
},
于 2016-09-12T16:39:45.713 に答える