use of uk.co.automatictester.lightning.data.JMeterTransactions in project lightning by automatictester.
the class RespTimeMedianTest method execute.
@Override
public void execute(ArrayList<String[]> originalJMeterTransactions) {
try {
JMeterTransactions transactions = filterTransactions((JMeterTransactions) originalJMeterTransactions);
transactionCount = transactions.getTransactionCount();
DescriptiveStatistics ds = new DescriptiveStatistics();
for (String[] transaction : transactions) {
String elapsed = transaction[1];
ds.addValue(Double.parseDouble(elapsed));
}
longestTransactions = transactions.getLongestTransactions();
actualResult = (int) ds.getPercentile(50);
actualResultDescription = String.format(ACTUAL_RESULT_MESSAGE, actualResult);
if (actualResult > maxRespTime) {
result = TestResult.FAIL;
} else {
result = TestResult.PASS;
}
} catch (Exception e) {
result = TestResult.ERROR;
actualResultDescription = e.getMessage();
}
}
use of uk.co.automatictester.lightning.data.JMeterTransactions 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();
}
}
use of uk.co.automatictester.lightning.data.JMeterTransactions in project lightning by automatictester.
the class JMeterCSVFileReader method getTransactions.
public JMeterTransactions getTransactions(File csvFile) {
long start = System.currentTimeMillis();
logger.debug("Reading CSV file - start");
JMeterTransactions jmeterTransactions = new JMeterTransactions();
try (FileReader fr = new FileReader(csvFile)) {
jmeterTransactions.addAll(getParser().parseAll(fr));
} catch (IOException e) {
throw new CSVFileIOException(e);
}
if (jmeterTransactions.isEmpty()) {
throw new CSVFileNoTransactionsException();
}
long finish = System.currentTimeMillis();
long millisecondsBetween = finish - start;
logger.debug("Reading CSV file - finish, read {} rows, took {}ms", jmeterTransactions.size(), millisecondsBetween);
return jmeterTransactions;
}
use of uk.co.automatictester.lightning.data.JMeterTransactions in project lightning by automatictester.
the class RespTimeAvgTest method execute.
@Override
public void execute(ArrayList<String[]> originalJMeterTransactions) {
try {
JMeterTransactions transactions = filterTransactions((JMeterTransactions) originalJMeterTransactions);
transactionCount = transactions.getTransactionCount();
DescriptiveStatistics ds = new DescriptiveStatistics();
for (String[] transaction : transactions) {
String elapsed = transaction[1];
ds.addValue(Double.parseDouble(elapsed));
}
longestTransactions = transactions.getLongestTransactions();
actualResult = (int) ds.getMean();
actualResultDescription = String.format(ACTUAL_RESULT_MESSAGE, actualResult);
if (actualResult > maxAvgRespTime) {
result = TestResult.FAIL;
} else {
result = TestResult.PASS;
}
} catch (Exception e) {
result = TestResult.ERROR;
actualResultDescription = e.getMessage();
}
}
use of uk.co.automatictester.lightning.data.JMeterTransactions in project lightning by automatictester.
the class ThroughputTestTest method testExecuteMethodFailNonInteger.
@Test
public void testExecuteMethodFailNonInteger() {
ThroughputTest test = new ThroughputTest("Test #1", "throughputTest", "", "Login", 0.7);
JMeterTransactions jmeterTransactions = new JMeterTransactions();
jmeterTransactions.add(TRANSACTION_0);
jmeterTransactions.add(TRANSACTION_3);
test.execute(jmeterTransactions);
assertThat(test.getResult(), is(equalTo(TestResult.FAIL)));
}
Aggregations