如何退出整个套件进行功能测试?

时间:2015-02-10 01:38:39

标签: intern

如何退出整个套件进行功能测试?我已经'设置'然后运行不同的测试,但想在套件内停止测试;如果我看到病情,不要继续下一次测试。目前,如果断言,则运行下一个测试。

例如:

// suite variable ??
var suiteFail = false;

registerSuite({
    name: 'Test Suite',

    setup: function () {

        //console.info('\n In setup');
        remote = this.remote;
        remote.setWindowSize(1024,768);
    }, // complete setup

    beforeEach: function () {
        if (suiteFail) {
            // stop suite ??
        }
    },

    'test1': function () {
    // set suiteFail true if condition 
    }

    'test2': function () {
    // set suiteFail true if condition 
    }

谢谢, 布拉德

1 个答案:

答案 0 :(得分:0)

beforeEachafterEach抛出异常将导致套件失败,并且不会执行任何剩余的测试,因此您可以执行以下操作:

beforeEach: function () {
    if (suiteFail) {
        throw new Error('Failing suite because X');
    }
}