Test order is randomized

This commit is contained in:
Ian Coleman
2016-08-23 18:25:38 +10:00
parent d077e1e716
commit fb3726873f
+16
View File
@@ -56,6 +56,21 @@ function next() {
}
}
/**
* Randomize array element order in-place.
* Using Durstenfeld shuffle algorithm.
* See http://stackoverflow.com/a/12646864
*/
function shuffle(array) {
for (var i = array.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var temp = array[i];
array[i] = array[j];
array[j] = temp;
}
return array;
}
tests = [
// Page loads with status of 'success'
@@ -602,4 +617,5 @@ page.open(url, function(status) {
];
console.log("Running tests...");
tests = shuffle(tests);
next();