Search in sources :

Example 51 with JMeterTransactions

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

the class RespTimeAvgTestTest method testPrintTestExecutionReport.

@Test
public void testPrintTestExecutionReport() {
    RespTimeAvgTest test = new RespTimeAvgTest("my name", "my type", "my description", "Search", 800);
    JMeterTransactions jmeterTransactions = new JMeterTransactions();
    jmeterTransactions.add(TestData.SEARCH_800_SUCCESS);
    String expectedOutput = String.format("Test name:            my name%n" + "Test type:            my type%n" + "Test description:     my description%n" + "Transaction name:     Search%n" + "Expected result:      Average response time <= 800%n" + "Actual result:        Average response time = 800%n" + "Transaction count:    1%n" + "Longest transactions: [800]%n" + "Test result:          Pass");
    test.execute(jmeterTransactions);
    String output = test.getTestExecutionReport();
    assertThat(output, containsString(expectedOutput));
}
Also used : JMeterTransactions(uk.co.automatictester.lightning.data.JMeterTransactions) Test(org.testng.annotations.Test)

Example 52 with JMeterTransactions

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

the class RespTimeAvgTestTest method verifyExecuteAllTransactionsPass.

@Test
public void verifyExecuteAllTransactionsPass() {
    RespTimeAvgTest test = new RespTimeAvgTest("Test #1", "avgRespTimeTest", "Verify response times", null, 900);
    JMeterTransactions jmeterTransactions = new JMeterTransactions();
    jmeterTransactions.add(TestData.SEARCH_800_SUCCESS);
    jmeterTransactions.add(TestData.LOGIN_1000_SUCCESS);
    test.execute(jmeterTransactions);
    assertThat(test.getResult(), is(equalTo(TestResult.PASS)));
}
Also used : JMeterTransactions(uk.co.automatictester.lightning.data.JMeterTransactions) Test(org.testng.annotations.Test)

Example 53 with JMeterTransactions

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

the class RespTimeAvgTestTest method verifyExecuteError.

@Test
public void verifyExecuteError() {
    RespTimeAvgTest test = new RespTimeAvgTest("Test #1", "avgRespTimeTest", "Verify response times", "nonexistent", 800);
    JMeterTransactions jmeterTransactions = new JMeterTransactions();
    jmeterTransactions.add(TestData.SEARCH_11221_SUCCESS);
    test.execute(jmeterTransactions);
    assertThat(test.getResult(), is(equalTo(TestResult.ERROR)));
}
Also used : JMeterTransactions(uk.co.automatictester.lightning.data.JMeterTransactions) Test(org.testng.annotations.Test)

Example 54 with JMeterTransactions

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

the class RespTimeAvgTestTest method verifyExecuteFail.

@Test
public void verifyExecuteFail() {
    RespTimeAvgTest test = new RespTimeAvgTest("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)));
}
Also used : JMeterTransactions(uk.co.automatictester.lightning.data.JMeterTransactions) Test(org.testng.annotations.Test)

Example 55 with JMeterTransactions

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

the class ThroughputTest method execute.

@Override
public void execute(ArrayList<String[]> originalJMeterTransactions) {
    try {
        JMeterTransactions transactions = filterTransactions((JMeterTransactions) originalJMeterTransactions);
        transactionCount = transactions.getTransactionCount();
        actualResult = transactions.getThroughput();
        actualResultDescription = String.format(ACTUAL_RESULT_MESSAGE, actualResult);
        if (actualResult < minThroughput) {
            result = TestResult.FAIL;
        } else {
            result = TestResult.PASS;
        }
    } catch (Exception e) {
        result = TestResult.ERROR;
        actualResultDescription = e.getMessage();
    }
}
Also used : JMeterTransactions(uk.co.automatictester.lightning.data.JMeterTransactions)

Aggregations

JMeterTransactions (uk.co.automatictester.lightning.data.JMeterTransactions)67 Test (org.testng.annotations.Test)58 DescriptiveStatistics (org.apache.commons.math3.stat.descriptive.DescriptiveStatistics)5 ClientSideTest (uk.co.automatictester.lightning.tests.ClientSideTest)5 PassedTransactionsTest (uk.co.automatictester.lightning.tests.PassedTransactionsTest)5 ServerSideTest (uk.co.automatictester.lightning.tests.ServerSideTest)5 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 CSVFileIOException (uk.co.automatictester.lightning.exceptions.CSVFileIOException)2 CSVFileNoTransactionsException (uk.co.automatictester.lightning.exceptions.CSVFileNoTransactionsException)2 RespTimeAvgTest (uk.co.automatictester.lightning.tests.RespTimeAvgTest)2 Percent (uk.co.automatictester.lightning.utils.Percent)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 FileReader (java.io.FileReader)1 InputStreamReader (java.io.InputStreamReader)1 Percentile (org.apache.commons.math3.stat.descriptive.rank.Percentile)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1 IntToOrdConverter (uk.co.automatictester.lightning.utils.IntToOrdConverter)1