量角器测试可以随机顺序进行吗? [英] Can protractor tests be run in a random order?
问题描述
我正在尝试在规范中强制量角器测试之间的独立性.为了检测测试是否依赖于先前测试引入的状态,我想以随机顺序运行这些测试.
I'm trying to enforce independence between protractor tests within a spec. To detect whether or not tests are depending on a state introduced by an previous test, I would like to run those tests in random order.
有没有一种方法可以告诉量角器测试的顺序可以随机化?
Is there a way to tell protractor the order of tests can be randomized?
I found a feature request for Jasmine at pivotaltracker
推荐答案
从17/10/10起,可以在protractor.conf.js JasmineNodeOpts中设置一个设置,以在使用Jasmine时以半随机顺序运行规范,无需代码.
As of 10/10/17, it's possible to set a setting in the protractor.conf.js JasmineNodeOpts to run specs in semi-random order when using Jasmine, no code needed.
在protract.conf.js文件中,添加以下json块:
In your protract.conf.js file add the following json block:
jasmineNodeOpts?: {
...
/**
* If true, run specs in semi-random order
*/
random?: boolean,
...
};
这篇关于量角器测试可以随机顺序进行吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!