Search in sources :

Example 6 with PerfMonDataEntries

use of uk.co.automatictester.lightning.data.PerfMonDataEntries in project lightning by automatictester.

the class ServerSideTestTest method verifyExecute_GreaterThan_Pass.

@Test
public void verifyExecute_GreaterThan_Pass() {
    ServerSideTest test = new ServerSideTest("Test #1", "serverSideTest", ServerSideTestType.GREATER_THAN, "Verify CPU utilisation", "192.168.0.12 CPU", 27499);
    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)));
}
Also used : PerfMonDataEntries(uk.co.automatictester.lightning.data.PerfMonDataEntries) Test(org.testng.annotations.Test)

Example 7 with PerfMonDataEntries

use of uk.co.automatictester.lightning.data.PerfMonDataEntries in project lightning by automatictester.

the class ServerSideTestTest method verifyExecute_OneEntry_LessThan_Pass.

@Test
public void verifyExecute_OneEntry_LessThan_Pass() {
    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);
    test.execute(dataEntries);
    assertThat(test.getResult(), is(equalTo(TestResult.PASS)));
}
Also used : PerfMonDataEntries(uk.co.automatictester.lightning.data.PerfMonDataEntries) Test(org.testng.annotations.Test)

Example 8 with PerfMonDataEntries

use of uk.co.automatictester.lightning.data.PerfMonDataEntries in project lightning by automatictester.

the class ServerSideTestTest method testPrintTestExecutionReportPass.

@Test
public void testPrintTestExecutionReportPass() {
    String expectedOutput = String.format("Test name:            Test #1%n" + "Test type:            serverSideTest%n" + "Test subtype:         Less than%n" + "Test description:     Verify CPU utilisation%n" + "Host and metric:      192.168.0.12 CPU%n" + "Expected result:      Average value < 10001%n" + "Actual result:        Average value = 10000%n" + "Entries count:        2%n" + "Test result:          Pass");
    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);
    String output = test.getTestExecutionReport();
    assertThat(output, containsString(expectedOutput));
}
Also used : PerfMonDataEntries(uk.co.automatictester.lightning.data.PerfMonDataEntries) Test(org.testng.annotations.Test)

Example 9 with PerfMonDataEntries

use of uk.co.automatictester.lightning.data.PerfMonDataEntries in project lightning by automatictester.

the class LightningHandler method runTests.

private void runTests() {
    long testSetExecStart = System.currentTimeMillis();
    LightningXMLS3ObjectReader xmlFileReader = new LightningXMLS3ObjectReader(region, bucket);
    xmlFileReader.readTests(xml);
    List<ClientSideTest> clientSideTests = xmlFileReader.getClientSideTests();
    List<ServerSideTest> serverSideTests = xmlFileReader.getServerSideTests();
    testSet = new TestSet(clientSideTests, serverSideTests);
    jmeterTransactions = new JMeterCSVS3ObjectReader(region, bucket).getTransactions(jmeterCsv);
    if (perfmonCsv != null) {
        PerfMonDataEntries perfMonDataEntries = new PerfMonS3ObjectDataReader(region, bucket).getDataEntires(perfmonCsv);
        testSet.executeServerSideTests(perfMonDataEntries);
    }
    testSet.executeClientSideTests(jmeterTransactions);
    String testExecutionReport = testSet.getTestExecutionReport();
    String testSetExecutionSummaryReport = new TestSetReporter(testSet).getTestSetExecutionSummaryReport();
    String combinedTestReport = String.format("\n%s%s\n", testExecutionReport, testSetExecutionSummaryReport);
    String combinedTestReportS3Path = s3Client.putS3Object("output/verify.log", combinedTestReport);
    response.setCombinedTestReport(combinedTestReportS3Path);
    log.info(combinedTestReport);
    long testSetExecEnd = System.currentTimeMillis();
    long testExecTime = testSetExecEnd - testSetExecStart;
    log.info("Total verify stage execution time:    {}ms", testExecTime);
    if (testSet.getFailCount() + testSet.getErrorCount() != 0) {
        response.setExitCode(1);
    } else {
        response.setExitCode(0);
    }
}
Also used : ClientSideTest(uk.co.automatictester.lightning.tests.ClientSideTest) ServerSideTest(uk.co.automatictester.lightning.tests.ServerSideTest) TestSetReporter(uk.co.automatictester.lightning.reporters.TestSetReporter) JMeterCSVS3ObjectReader(uk.co.automatictester.lightning.lambda.readers.JMeterCSVS3ObjectReader) LightningXMLS3ObjectReader(uk.co.automatictester.lightning.lambda.readers.LightningXMLS3ObjectReader) PerfMonS3ObjectDataReader(uk.co.automatictester.lightning.lambda.readers.PerfMonS3ObjectDataReader) PerfMonDataEntries(uk.co.automatictester.lightning.data.PerfMonDataEntries) TestSet(uk.co.automatictester.lightning.TestSet)

Example 10 with PerfMonDataEntries

use of uk.co.automatictester.lightning.data.PerfMonDataEntries in project lightning by automatictester.

the class LightningMojo method runTests.

private void runTests() {
    long testSetExecStart = System.currentTimeMillis();
    LightningXMLFileReader xmlFileReader = new LightningXMLFileReader();
    xmlFileReader.readTests(testSetXml);
    List<ClientSideTest> clientSideTests = xmlFileReader.getClientSideTests();
    List<ServerSideTest> serverSideTests = xmlFileReader.getServerSideTests();
    testSet = new TestSet(clientSideTests, serverSideTests);
    jmeterTransactions = new JMeterCSVFileReader().getTransactions(jmeterCsv);
    if (perfmonCsv != null) {
        PerfMonDataEntries perfMonDataEntries = new PerfMonDataReader().getDataEntires(perfmonCsv);
        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;
    }
}
Also used : ClientSideTest(uk.co.automatictester.lightning.tests.ClientSideTest) ServerSideTest(uk.co.automatictester.lightning.tests.ServerSideTest) TestSetReporter(uk.co.automatictester.lightning.reporters.TestSetReporter) JMeterCSVFileReader(uk.co.automatictester.lightning.readers.JMeterCSVFileReader) PerfMonDataReader(uk.co.automatictester.lightning.readers.PerfMonDataReader) PerfMonDataEntries(uk.co.automatictester.lightning.data.PerfMonDataEntries) LightningXMLFileReader(uk.co.automatictester.lightning.readers.LightningXMLFileReader) TestSet(uk.co.automatictester.lightning.TestSet)

Aggregations

PerfMonDataEntries (uk.co.automatictester.lightning.data.PerfMonDataEntries)17 Test (org.testng.annotations.Test)12 ClientSideTest (uk.co.automatictester.lightning.tests.ClientSideTest)4 ServerSideTest (uk.co.automatictester.lightning.tests.ServerSideTest)4 TestSet (uk.co.automatictester.lightning.TestSet)3 TestSetReporter (uk.co.automatictester.lightning.reporters.TestSetReporter)3 JMeterCSVFileReader (uk.co.automatictester.lightning.readers.JMeterCSVFileReader)2 LightningXMLFileReader (uk.co.automatictester.lightning.readers.LightningXMLFileReader)2 PerfMonDataReader (uk.co.automatictester.lightning.readers.PerfMonDataReader)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 ArrayList (java.util.ArrayList)1 DescriptiveStatistics (org.apache.commons.math3.stat.descriptive.DescriptiveStatistics)1 CSVFileIOException (uk.co.automatictester.lightning.exceptions.CSVFileIOException)1 CSVFileNoTransactionsException (uk.co.automatictester.lightning.exceptions.CSVFileNoTransactionsException)1 JMeterCSVS3ObjectReader (uk.co.automatictester.lightning.lambda.readers.JMeterCSVS3ObjectReader)1 LightningXMLS3ObjectReader (uk.co.automatictester.lightning.lambda.readers.LightningXMLS3ObjectReader)1 PerfMonS3ObjectDataReader (uk.co.automatictester.lightning.lambda.readers.PerfMonS3ObjectDataReader)1 PassedTransactionsTest (uk.co.automatictester.lightning.tests.PassedTransactionsTest)1