use of uk.co.automatictester.lightning.data.JMeterTransactions in project lightning by automatictester.
the class RespTimeMaxTestTest method verifyExecuteFail.
@Test
public void verifyExecuteFail() {
RespTimeMaxTest test = new RespTimeMaxTest("Test #1", "avgRespTimeTest", "Verify response times", "Search", 11220);
JMeterTransactions jmeterTransactions = new JMeterTransactions();
jmeterTransactions.add(TestData.SEARCH_11221_SUCCESS);
test.execute(jmeterTransactions);
assertThat(test.getResult(), is(equalTo(TestResult.FAIL)));
assertThat(test.getActualResult(), equalTo(11221));
}
use of uk.co.automatictester.lightning.data.JMeterTransactions in project lightning by automatictester.
the class RespTimeAvgTestTest method verifyExecutePassOnNonDefaultLocale.
@Test
public void verifyExecutePassOnNonDefaultLocale() {
Locale.setDefault(Locale.FRENCH);
RespTimeAvgTest test = new RespTimeAvgTest("Test #1", "avgRespTimeTest", "Verify response times", "Search", 6010);
JMeterTransactions jmeterTransactions = new JMeterTransactions();
jmeterTransactions.add(TestData.SEARCH_800_SUCCESS);
jmeterTransactions.add(TestData.SEARCH_11221_SUCCESS);
test.execute(jmeterTransactions);
assertThat(test.getResult(), is(equalTo(TestResult.PASS)));
}
use of uk.co.automatictester.lightning.data.JMeterTransactions in project lightning by automatictester.
the class RespTimeAvgTestTest method verifyExecutePass.
@Test
public void verifyExecutePass() {
RespTimeAvgTest test = new RespTimeAvgTest("Test #1", "avgRespTimeTest", "Verify response times", "Search", 800);
JMeterTransactions jmeterTransactions = new JMeterTransactions();
jmeterTransactions.add(TestData.SEARCH_800_SUCCESS);
test.execute(jmeterTransactions);
assertThat(test.getResult(), is(equalTo(TestResult.PASS)));
}
use of uk.co.automatictester.lightning.data.JMeterTransactions in project lightning by automatictester.
the class RespTimeStdDevTest 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));
}
actualResult = (int) ds.getStandardDeviation();
actualResultDescription = String.format(ACTUAL_RESULT_MESSAGE, actualResult);
if (actualResult > maxRespTimeStdDev) {
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 PassedTransactionsTest method execute.
@Override
public void execute(ArrayList<String[]> originalJMeterTransactions) {
try {
JMeterTransactions transactions = filterTransactions((JMeterTransactions) originalJMeterTransactions);
transactionCount = transactions.getTransactionCount();
int failureCount = 0;
for (String[] transaction : transactions) {
String success = transaction[2];
if (!Boolean.parseBoolean(success)) {
failureCount++;
}
}
if (type.equals(ThresholdType.NUMBER)) {
if (failureCount > allowedNumberOfFailedTransactions) {
result = TestResult.FAIL;
} else {
result = TestResult.PASS;
}
this.actualResult = failureCount;
actualResultDescription = String.format(ACTUAL_RESULT_MESSAGE, this.type.toString(), failureCount);
} else {
int percentOfFailedTransactions = (int) (((float) failureCount / transactionCount) * 100);
if (percentOfFailedTransactions > (float) allowedPercentOfFailedTransactions.getValue()) {
result = TestResult.FAIL;
} else {
result = TestResult.PASS;
}
this.actualResult = percentOfFailedTransactions;
actualResultDescription = String.format(ACTUAL_RESULT_MESSAGE, this.type.toString(), percentOfFailedTransactions);
}
} catch (Exception e) {
result = TestResult.ERROR;
actualResultDescription = e.getMessage();
}
}
Aggregations