Search in sources :

Example 1 with PassedTransactionsTest

use of uk.co.automatictester.lightning.tests.PassedTransactionsTest in project lightning by automatictester.

the class TeamCityReporterTest method testPrintTeamCityVerifyStatistics.

@Test
public void testPrintTeamCityVerifyStatistics() {
    final PassedTransactionsTest clientTest = mock(PassedTransactionsTest.class);
    when(clientTest.getName()).thenReturn("Failed transactions");
    when(clientTest.getActualResult()).thenReturn(1);
    final ServerSideTest serverTest = mock(ServerSideTest.class);
    when(serverTest.getName()).thenReturn("Memory utilization");
    when(serverTest.getActualResult()).thenReturn(45);
    TestSet testSet = mock(TestSet.class);
    when(testSet.getClientSideTests()).thenReturn(new ArrayList<ClientSideTest>() {

        {
            add(clientTest);
        }
    });
    when(testSet.getServerSideTests()).thenReturn(new ArrayList<ServerSideTest>() {

        {
            add(serverTest);
        }
    });
    String output = new TeamCityReporter(testSet).getTeamCityVerifyStatistics();
    assertThat(output, containsString("##teamcity[buildStatisticValue key='Failed transactions' value='1']"));
    assertThat(output, containsString("##teamcity[buildStatisticValue key='Memory utilization' value='45']"));
}
Also used : ServerSideTest(uk.co.automatictester.lightning.tests.ServerSideTest) ClientSideTest(uk.co.automatictester.lightning.tests.ClientSideTest) PassedTransactionsTest(uk.co.automatictester.lightning.tests.PassedTransactionsTest) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) TestSet(uk.co.automatictester.lightning.TestSet) 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 2 with PassedTransactionsTest

use of uk.co.automatictester.lightning.tests.PassedTransactionsTest in project lightning by automatictester.

the class TestSetTest method verifyExecuteClientMethod_2_0_0.

@Test
public void verifyExecuteClientMethod_2_0_0() {
    PassedTransactionsTest passedTransactionsTestA = new PassedTransactionsTest("Test #1", "passedTransactionsTest", "Verify number of passed tests", "Login", 0);
    PassedTransactionsTest passedTransactionsTestB = new PassedTransactionsTest("Test #2", "passedTransactionsTest", "Verify number of passed tests", null, 0);
    JMeterTransactions transactions = new JMeterTransactions();
    transactions.add(TestData.LOGIN_3514_SUCCESS);
    transactions.add(TestData.SEARCH_11221_SUCCESS);
    List<ClientSideTest> tests = new ArrayList<>();
    tests.add(passedTransactionsTestA);
    tests.add(passedTransactionsTestB);
    TestSet testSet = new TestSet(tests, null);
    configureStream();
    testSet.executeClientSideTests(transactions);
    revertStream();
    assertThat(testSet.getTestCount(), is(2));
    assertThat(testSet.getPassCount(), is(2));
    assertThat(testSet.getFailCount(), is(0));
    assertThat(testSet.getErrorCount(), is(0));
}
Also used : ClientSideTest(uk.co.automatictester.lightning.tests.ClientSideTest) ArrayList(java.util.ArrayList) PassedTransactionsTest(uk.co.automatictester.lightning.tests.PassedTransactionsTest) JMeterTransactions(uk.co.automatictester.lightning.data.JMeterTransactions) RespTimeAvgTest(uk.co.automatictester.lightning.tests.RespTimeAvgTest) Test(org.testng.annotations.Test) PassedTransactionsTest(uk.co.automatictester.lightning.tests.PassedTransactionsTest) ServerSideTest(uk.co.automatictester.lightning.tests.ServerSideTest) ClientSideTest(uk.co.automatictester.lightning.tests.ClientSideTest)

Aggregations

Test (org.testng.annotations.Test)2 ClientSideTest (uk.co.automatictester.lightning.tests.ClientSideTest)2 PassedTransactionsTest (uk.co.automatictester.lightning.tests.PassedTransactionsTest)2 ServerSideTest (uk.co.automatictester.lightning.tests.ServerSideTest)2 ArrayList (java.util.ArrayList)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 TestSet (uk.co.automatictester.lightning.TestSet)1 JMeterTransactions (uk.co.automatictester.lightning.data.JMeterTransactions)1 RespTimeAvgTest (uk.co.automatictester.lightning.tests.RespTimeAvgTest)1