发布于 2017-10-10 05:16:02
从10/10/17开始,可以在protractor.conf.js JasmineNodeOpts中设置一个设置,以便在使用Jasmine时以半随机顺序运行规范,不需要任何代码。
在protract.conf.js文件中添加以下json块:
jasmineNodeOpts?: {
...
/**
* If true, run specs in semi-random order
*/
random?: boolean,
...
};
发布于 2016-06-08 04:12:50
您可以通过在套件结束时对它们进行洗牌,以随机顺序执行规范:
var shuffle = function (items) {
var item, ii;
for(var i = 0; i < items.length; i++){
ii = (Math.random() * items.length) | 0;
item = items[i];
items[i] = items[ii];
items[ii] = item;
}
}
describe('Suite', function() {
it("should a", function () {
console.log("execute a");
});
it("should b", function () {
console.log("execute b");
});
it("should c", function () {
console.log("execute c");
});
shuffle(this.children); // shuffle the specs
});
https://stackoverflow.com/questions/37696460
复制相似问题