Search in sources :

Example 1 with IntToOrdConverter

use of uk.co.automatictester.lightning.utils.IntToOrdConverter in project lightning by automatictester.

the class RespTimeNthPercentileTest method execute.

@Override
public void execute(ArrayList<String[]> originalJMeterTransactions) {
    try {
        JMeterTransactions transactions = filterTransactions((JMeterTransactions) originalJMeterTransactions);
        transactionCount = transactions.getTransactionCount();
        DescriptiveStatistics ds = new DescriptiveStatistics();
        ds.setPercentileImpl(new Percentile().withEstimationType(Percentile.EstimationType.R_3));
        for (String[] transaction : transactions) {
            String elapsed = transaction[1];
            ds.addValue(Double.parseDouble(elapsed));
        }
        longestTransactions = transactions.getLongestTransactions();
        actualResult = (int) ds.getPercentile((double) percentile);
        actualResultDescription = String.format(ACTUAL_RESULT_MESSAGE, new IntToOrdConverter().convert(percentile), actualResult);
        if (actualResult > maxRespTime) {
            result = TestResult.FAIL;
        } else {
            result = TestResult.PASS;
        }
    } catch (Exception e) {
        result = TestResult.ERROR;
        actualResultDescription = e.getMessage();
    }
}
Also used : DescriptiveStatistics(org.apache.commons.math3.stat.descriptive.DescriptiveStatistics) Percentile(org.apache.commons.math3.stat.descriptive.rank.Percentile) IntToOrdConverter(uk.co.automatictester.lightning.utils.IntToOrdConverter) JMeterTransactions(uk.co.automatictester.lightning.data.JMeterTransactions)

Aggregations

DescriptiveStatistics (org.apache.commons.math3.stat.descriptive.DescriptiveStatistics)1 Percentile (org.apache.commons.math3.stat.descriptive.rank.Percentile)1 JMeterTransactions (uk.co.automatictester.lightning.data.JMeterTransactions)1 IntToOrdConverter (uk.co.automatictester.lightning.utils.IntToOrdConverter)1