use of uk.co.automatictester.lightning.data.JMeterTransactions in project lightning by automatictester.
the class JMeterReporterTest method testPrintJMeterReport.
@Test(dataProvider = "counts")
public void testPrintJMeterReport(int total, int failures) {
String expectedOutput = String.format("Transactions executed: %d, failed: %d", total, failures);
JMeterTransactions transactions = mock(JMeterTransactions.class);
when(transactions.getTransactionCount()).thenReturn(total);
when(transactions.getFailCount()).thenReturn(failures);
String output = new JMeterReporter(transactions).getJMeterReport();
assertThat(output, containsString(expectedOutput));
}
use of uk.co.automatictester.lightning.data.JMeterTransactions in project lightning by automatictester.
the class PassedTransactionsTestTest method verifyExecuteMethodPass.
@Test
public void verifyExecuteMethodPass() {
PassedTransactionsTest test = new PassedTransactionsTest("Test #1", "passedTransactionsTest", "Verify number of passed tests", "Login", 0);
JMeterTransactions jmeterTransactions = new JMeterTransactions();
jmeterTransactions.add(TestData.LOGIN_1000_SUCCESS);
test.execute(jmeterTransactions);
assertThat(test.getResult(), is(equalTo(TestResult.PASS)));
assertThat(test.getActualResultDescription(), containsString("Number of failed transactions = 0"));
}
use of uk.co.automatictester.lightning.data.JMeterTransactions in project lightning by automatictester.
the class PassedTransactionsTestTest method testPrintTestExecutionReportIgnored.
@Test
public void testPrintTestExecutionReportIgnored() {
String expectedOutput = String.format("Test name: Test #1%n" + "Test type: passedTransactionsTest%n" + "Test description: Verify number of passed tests%n" + "Transaction name: incorrect%n" + "Expected result: Number of failed transactions <= 0%n" + "Actual result: No transactions with label equal to 'incorrect' found in CSV file%n" + "Transaction count: 0%n" + "Test result: ERROR");
PassedTransactionsTest test = new PassedTransactionsTest("Test #1", "passedTransactionsTest", "Verify number of passed tests", "incorrect", 0);
JMeterTransactions jmeterTransactions = new JMeterTransactions();
jmeterTransactions.add(TestData.LOGIN_1000_SUCCESS);
test.execute(jmeterTransactions);
String output = test.getTestExecutionReport();
assertThat(output, containsString(expectedOutput));
}
use of uk.co.automatictester.lightning.data.JMeterTransactions in project lightning by automatictester.
the class TestSetTest method verifyExecuteClientMethod_1_1_1.
@Test
public void verifyExecuteClientMethod_1_1_1() {
RespTimeAvgTest respTimeAvgTestA = new RespTimeAvgTest("Test #1", "avgRespTimeTest", "", "Login", 4000);
RespTimeAvgTest respTimeAvgTestB = new RespTimeAvgTest("Test #2", "avgRespTimeTest", "", "Search", 5000);
RespTimeAvgTest respTimeAvgTestC = new RespTimeAvgTest("Test #3", "avgRespTimeTest", "", "Sear", 1000);
JMeterTransactions transactions = new JMeterTransactions();
transactions.add(TestData.LOGIN_3514_SUCCESS);
transactions.add(TestData.SEARCH_11221_SUCCESS);
List<ClientSideTest> tests = new ArrayList<>();
tests.add(respTimeAvgTestA);
tests.add(respTimeAvgTestB);
tests.add(respTimeAvgTestC);
TestSet testSet = new TestSet(tests, null);
configureStream();
testSet.executeClientSideTests(transactions);
revertStream();
assertThat(testSet.getTestCount(), is(3));
assertThat(testSet.getPassCount(), is(1));
assertThat(testSet.getFailCount(), is(1));
assertThat(testSet.getErrorCount(), is(1));
}
use of uk.co.automatictester.lightning.data.JMeterTransactions 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));
}
Aggregations