2015-02-10 72 views
0

如何退出功能测试的整个套件?我有'设置',然后运行不同的测试,但想要停止套件内的测试;如果我看到条件,请不要继续下一次测试。目前,如果声明,则会运行下一个测试。如何退出整个套件进行功能测试?

例如:

// 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 
    } 

感谢, 布拉德

回答

0

抛掷beforeEachafterEach异常会导致套件失败,和任何剩余的测试将不会被执行,所以你可以做些什么如:

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