UNPKG

wdio-performancetotal-service

Version:

WebdriverIO service for analyzing test flow performance

22 lines (21 loc) 778 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class Calculator { getAverageAndStandardDeviation(durationList) { const mean = this.getAverageTimeSpan(durationList); let sos = 0; let sem = 0; // calculate sem if (durationList.length > 1) { durationList.forEach(d => sos += Math.pow(d - mean, 2)); const std = Math.sqrt(sos / (durationList.length - 1)); sem = std / Math.sqrt(durationList.length); } return [Math.round(mean), Math.round(sem)]; } getAverageTimeSpan(durationList) { const result = durationList.reduce((a, b) => a + b, 0) / durationList.length; return Math.round(result); } } exports.default = new Calculator();