use of uk.co.automatictester.lightning.data.PerfMonDataEntries in project lightning by automatictester.
the class ServerSideTest method execute.
@Override
public void execute(ArrayList<String[]> originalDataEntries) {
try {
PerfMonDataEntries dataEntries = filterDataEntries((PerfMonDataEntries) originalDataEntries);
dataEntriesCount = dataEntries.getDataEntriesCount();
DescriptiveStatistics ds = new DescriptiveStatistics();
for (String[] transaction : dataEntries) {
String elapsed = transaction[1];
ds.addValue(Double.parseDouble(elapsed));
}
actualResult = (int) ds.getMean();
actualResultDescription = String.format(ACTUAL_RESULT_MESSAGE, actualResult);
if (subtype.equals(ServerSideTestType.GREATER_THAN)) {
expectedResultDescription = String.format(expectedResultMessage, metricValueA);
if (actualResult > metricValueA) {
result = TestResult.PASS;
} else {
result = TestResult.FAIL;
}
} else if (subtype.equals(ServerSideTestType.LESS_THAN)) {
expectedResultDescription = String.format(expectedResultMessage, metricValueA);
if (actualResult < metricValueA) {
result = TestResult.PASS;
} else {
result = TestResult.FAIL;
}
} else if (subtype.equals(ServerSideTestType.BETWEEN)) {
expectedResultDescription = String.format(expectedResultMessage, metricValueA, metricValueB);
if ((actualResult > metricValueA) && (actualResult < metricValueB)) {
result = TestResult.PASS;
} else {
result = TestResult.FAIL;
}
}
} catch (Exception e) {
result = TestResult.ERROR;
actualResultDescription = e.getMessage();
}
}
use of uk.co.automatictester.lightning.data.PerfMonDataEntries in project lightning by automatictester.
the class LightningTask method runTests.
void runTests() {
long testSetExecStart = System.currentTimeMillis();
LightningXMLFileReader xmlFileReader = new LightningXMLFileReader();
xmlFileReader.readTests(extension.getTestSetXml());
List<ClientSideTest> clientSideTests = xmlFileReader.getClientSideTests();
List<ServerSideTest> serverSideTests = xmlFileReader.getServerSideTests();
testSet = new TestSet(clientSideTests, serverSideTests);
jmeterTransactions = new JMeterCSVFileReader().getTransactions(extension.getJmeterCsv());
if (extension.getPerfmonCsv() != null) {
PerfMonDataEntries perfMonDataEntries = new PerfMonDataReader().getDataEntires(extension.getPerfmonCsv());
testSet.executeServerSideTests(perfMonDataEntries);
}
testSet.executeClientSideTests(jmeterTransactions);
log(testSet.getTestExecutionReport());
log(new TestSetReporter(testSet).getTestSetExecutionSummaryReport());
long testSetExecEnd = System.currentTimeMillis();
long testExecTime = testSetExecEnd - testSetExecStart;
log(String.format("Execution time: %dms", testExecTime));
if (testSet.getFailCount() + testSet.getErrorCount() != 0) {
exitCode = 1;
}
}
use of uk.co.automatictester.lightning.data.PerfMonDataEntries in project lightning by automatictester.
the class PerfMonDataReaderTest method verifyReadMethod.
@Test
public void verifyReadMethod() {
PerfMonDataEntries perfMonDataEntries = new PerfMonDataReader().getDataEntires(TestData.CSV_2_ENTRIES);
assertThat(perfMonDataEntries, CoreMatchers.hasItem(TestData.CPU_ENTRY_9128));
assertThat(perfMonDataEntries, CoreMatchers.hasItem(TestData.CPU_ENTRY_21250));
}
use of uk.co.automatictester.lightning.data.PerfMonDataEntries in project lightning by automatictester.
the class ServerSideTestTest method verifyExecute_LessThan_Pass_NonDefaultLocale.
@Test
public void verifyExecute_LessThan_Pass_NonDefaultLocale() {
Locale.setDefault(Locale.FRENCH);
ServerSideTest test = new ServerSideTest("Test #1", "serverSideTest", ServerSideTestType.LESS_THAN, "Verify CPU utilisation", "192.168.0.12 CPU", 10001);
PerfMonDataEntries dataEntries = new PerfMonDataEntries();
dataEntries.add(TestData.CPU_ENTRY_10000);
dataEntries.add(TestData.CPU_ENTRY_10001);
test.execute(dataEntries);
assertThat(test.getResult(), is(equalTo(TestResult.PASS)));
}
use of uk.co.automatictester.lightning.data.PerfMonDataEntries in project lightning by automatictester.
the class ServerSideTestTest method verifyExecute_Between_Pass.
@Test
public void verifyExecute_Between_Pass() {
ServerSideTest test = new ServerSideTest("Test #1", "serverSideTest", ServerSideTestType.BETWEEN, "Verify CPU utilisation", "192.168.0.12 CPU", 20000, 27501);
PerfMonDataEntries dataEntries = new PerfMonDataEntries();
dataEntries.add(TestData.CPU_ENTRY_25000);
dataEntries.add(TestData.CPU_ENTRY_30000);
test.execute(dataEntries);
assertThat(test.getResult(), is(equalTo(TestResult.PASS)));
}
Aggregations