Search in sources :

Example 61 with JMeterTransactions

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

the class LightningTestTest method testFilterTransactionsAll.

@Test
public void testFilterTransactionsAll() {
    JMeterTransactions jmeterTransactions = new JMeterTransactions();
    jmeterTransactions.add(TestData.LOGIN_1000_SUCCESS);
    jmeterTransactions.add(TestData.SEARCH_800_SUCCESS);
    ClientSideTest test = Mockito.mock(ClientSideTest.class, Mockito.CALLS_REAL_METHODS);
    when(test.getTransactionName()).thenReturn(null);
    JMeterTransactions filteredTransactions = test.filterTransactions(jmeterTransactions);
    assertThat(filteredTransactions.getTransactionCount(), is(equalTo((2))));
}
Also used : JMeterTransactions(uk.co.automatictester.lightning.data.JMeterTransactions) Test(org.testng.annotations.Test)

Example 62 with JMeterTransactions

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

the class PassedTransactionsTestTest method testPrintTestExecutionReportPassNoDescription.

@Test
public void testPrintTestExecutionReportPassNoDescription() {
    String expectedOutput = String.format("Test name:            Test #1%n" + "Test type:            passedTransactionsTest%n" + "Transaction name:     Login%n" + "Expected result:      Number of failed transactions <= 0%n" + "Actual result:        Number of failed transactions = 0%n" + "Transaction count:    1%n" + "Test result:          Pass");
    PassedTransactionsTest test = new PassedTransactionsTest("Test #1", "passedTransactionsTest", "", "Login", 0);
    JMeterTransactions jmeterTransactions = new JMeterTransactions();
    jmeterTransactions.add(TestData.LOGIN_1000_SUCCESS);
    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 63 with JMeterTransactions

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

the class PassedTransactionsTestTest method verifyExecuteMethodError.

@Test
public void verifyExecuteMethodError() {
    PassedTransactionsTest test = new PassedTransactionsTest("Test #1", "passedTransactionsTest", "Verify number of passed tests", "nonexistent", 0);
    JMeterTransactions jmeterTransactions = new JMeterTransactions();
    jmeterTransactions.add(TestData.LOGIN_1200_FAILURE);
    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 64 with JMeterTransactions

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

the class PassedTransactionsTestTest method verifyExecuteMethodRegexpFail.

@Test
public void verifyExecuteMethodRegexpFail() {
    PassedTransactionsTest test = new PassedTransactionsTest("Test #1", "passedTransactionsTest", "Verify number of passed tests", "Log[a-z]ut", 0);
    test.setRegexp(true);
    JMeterTransactions jmeterTransactions = new JMeterTransactions();
    jmeterTransactions.add(TestData.LOGOUT_1000_SUCCESS);
    jmeterTransactions.add(TestData.LOGOUT_1000_FAILURE);
    test.execute(jmeterTransactions);
    assertThat(test.getResult(), is(equalTo(TestResult.FAIL)));
    assertThat(test.getActualResultDescription(), containsString("Number of failed transactions = 1"));
}
Also used : JMeterTransactions(uk.co.automatictester.lightning.data.JMeterTransactions) Test(org.testng.annotations.Test)

Example 65 with JMeterTransactions

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

the class PassedTransactionsTestTest method verifyExecuteMethodPercentPass.

@Test
public void verifyExecuteMethodPercentPass() {
    PassedTransactionsTest test = new PassedTransactionsTest("Test #1", "passedTransactionsTest", "Verify percent of passed tests", "Search", new Percent(10));
    JMeterTransactions jmeterTransactions = new JMeterTransactions();
    jmeterTransactions.add(TestData.SEARCH_1_SUCCESS);
    jmeterTransactions.add(TestData.SEARCH_2_SUCCESS);
    jmeterTransactions.add(TestData.SEARCH_3_SUCCESS);
    jmeterTransactions.add(TestData.SEARCH_4_SUCCESS);
    jmeterTransactions.add(TestData.SEARCH_5_SUCCESS);
    jmeterTransactions.add(TestData.SEARCH_6_SUCCESS);
    jmeterTransactions.add(TestData.SEARCH_7_SUCCESS);
    jmeterTransactions.add(TestData.SEARCH_8_SUCCESS);
    jmeterTransactions.add(TestData.SEARCH_9_SUCCESS);
    jmeterTransactions.add(TestData.SEARCH_800_FAILURE);
    test.execute(jmeterTransactions);
    assertThat(test.getResult(), is(equalTo(TestResult.PASS)));
    assertThat(test.getActualResultDescription(), containsString("Percent of failed transactions = 10"));
}
Also used : Percent(uk.co.automatictester.lightning.utils.Percent) JMeterTransactions(uk.co.automatictester.lightning.data.JMeterTransactions) Test(org.testng.annotations.Test)

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