Search in sources :

Example 6 with JMeterTransactions

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

the class ThroughputTestTest method testExecuteMethodError.

@Test
public void testExecuteMethodError() {
    ThroughputTest test = new ThroughputTest("Test #1", "throughputTest", "", "nonexistent", 2);
    JMeterTransactions jmeterTransactions = new JMeterTransactions();
    jmeterTransactions.add(TRANSACTION_0);
    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 7 with JMeterTransactions

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

the class TeamCityReporterTest method testPrintTeamCityReportStatistics.

@Test
public void testPrintTeamCityReportStatistics() {
    JMeterTransactions jmeterTransactions = mock(JMeterTransactions.class);
    when(jmeterTransactions.getTransactionCount()).thenReturn(1204);
    when(jmeterTransactions.getFailCount()).thenReturn(25);
    String output = new TeamCityReporter(jmeterTransactions).getTeamCityReportStatistics();
    assertThat(output, containsString("##teamcity[buildStatisticValue key='Failed transactions' value='25']"));
    assertThat(output, containsString("##teamcity[buildStatisticValue key='Total transactions' value='1204']"));
}
Also used : CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) JMeterTransactions(uk.co.automatictester.lightning.data.JMeterTransactions) Test(org.testng.annotations.Test) PassedTransactionsTest(uk.co.automatictester.lightning.tests.PassedTransactionsTest) ClientSideTest(uk.co.automatictester.lightning.tests.ClientSideTest) ServerSideTest(uk.co.automatictester.lightning.tests.ServerSideTest)

Example 8 with JMeterTransactions

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

the class TeamCityReporterTest method testSetTeamCityBuildStatusTextTest_report_passed.

@Test
public void testSetTeamCityBuildStatusTextTest_report_passed() {
    String expectedOutput = String.format("##teamcity[buildStatus text='Transactions executed: 10, failed: 0']");
    JMeterTransactions jmeterTransactions = mock(JMeterTransactions.class);
    when(jmeterTransactions.getTransactionCount()).thenReturn(10);
    when(jmeterTransactions.getFailCount()).thenReturn(0);
    String output = new TeamCityReporter(jmeterTransactions).getTeamCityBuildStatusText();
    assertThat(output, containsString(expectedOutput));
}
Also used : CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) JMeterTransactions(uk.co.automatictester.lightning.data.JMeterTransactions) Test(org.testng.annotations.Test) PassedTransactionsTest(uk.co.automatictester.lightning.tests.PassedTransactionsTest) ClientSideTest(uk.co.automatictester.lightning.tests.ClientSideTest) ServerSideTest(uk.co.automatictester.lightning.tests.ServerSideTest)

Example 9 with JMeterTransactions

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

the class TeamCityReporterTest method testSetTeamCityBuildStatusTextTest_report_failed.

@Test
public void testSetTeamCityBuildStatusTextTest_report_failed() {
    String expectedOutput = String.format("##teamcity[buildProblem description='Transactions executed: 10, failed: 1']");
    JMeterTransactions jmeterTransactions = mock(JMeterTransactions.class);
    when(jmeterTransactions.getTransactionCount()).thenReturn(10);
    when(jmeterTransactions.getFailCount()).thenReturn(1);
    String output = new TeamCityReporter(jmeterTransactions).getTeamCityBuildStatusText();
    assertThat(output, containsString(expectedOutput));
}
Also used : CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) JMeterTransactions(uk.co.automatictester.lightning.data.JMeterTransactions) Test(org.testng.annotations.Test) PassedTransactionsTest(uk.co.automatictester.lightning.tests.PassedTransactionsTest) ClientSideTest(uk.co.automatictester.lightning.tests.ClientSideTest) ServerSideTest(uk.co.automatictester.lightning.tests.ServerSideTest)

Example 10 with JMeterTransactions

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

the class LightningTestTest method testFilterTransactionsSome.

@Test
public void testFilterTransactionsSome() {
    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("Search");
    JMeterTransactions filteredTransactions = test.filterTransactions(jmeterTransactions);
    assertThat(filteredTransactions.getTransactionCount(), is(equalTo((1))));
}
Also used : 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