0
我想通過一些選項循環,並根據這些選項在摩卡生成測試。我已經建立了一個簡單的動態測試概念證明,基於這個要點:https://gist.github.com/cybertk/fff8992e12a7655157ed在摩卡動態構建測試 - TypeError:test.retries不是函數
當我運行dynamicSuite.addTest()時,我總是收到錯誤:「TypeError:test.retries不是函數」 。我無法弄清楚是什麼導致了錯誤。似乎沒有太多關於摩卡建設測試方法的文檔。
下面的代碼:
var dynamicSuite = describe('dynamic suite', function() {
this.timeout(10000);
before(function (done) {
var a = ['a', 'b', 'c'];
for(let item of a){
dynamicSuite.addTest(new common.Mocha.Test('test' + item, function(done){
done();
}));
}
done();
});
it('this is needed to make sure tests run', function (done) {
done();
});
after(function(done) {
done();
});
});//end describe test block
謝謝。我猜人們不會使用TDD風格? – mags