use of uk.co.automatictester.lightning.data.JMeterTransactions in project lightning by automatictester.
the class PassedTransactionsTestTest method verifyExecuteMethodPercentFail.
@Test
public void verifyExecuteMethodPercentFail() {
PassedTransactionsTest test = new PassedTransactionsTest("Test #1", "passedTransactionsTest", "Verify percent of passed tests", "Search", new Percent(9));
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.FAIL)));
assertThat(test.getActualResultDescription(), containsString("Percent of failed transactions = 10"));
}
use of uk.co.automatictester.lightning.data.JMeterTransactions in project lightning by automatictester.
the class JMeterCSVFileReaderTest method verifyReadMethod.
@Test
public void verifyReadMethod() {
JMeterTransactions jmeterTransactions = new JMeterCSVFileReader().getTransactions(CSV_2_TRANSACTIONS);
assertThat(jmeterTransactions, hasItem(LOGIN_3514_SUCCESS));
assertThat(jmeterTransactions, hasItem(SEARCH_11221_SUCCESS));
}
use of uk.co.automatictester.lightning.data.JMeterTransactions in project lightning by automatictester.
the class PassedTransactionsTestTest method testPrintTestExecutionReportFail.
@Test
public void testPrintTestExecutionReportFail() {
String expectedOutput = String.format("Test name: Test #1%n" + "Test type: passedTransactionsTest%n" + "Test description: Verify number of passed tests%n" + "Transaction name: Login%n" + "Expected result: Number of failed transactions <= 0%n" + "Actual result: Number of failed transactions = 1%n" + "Transaction count: 1%n" + "Test result: FAIL");
PassedTransactionsTest test = new PassedTransactionsTest("Test #1", "passedTransactionsTest", "Verify number of passed tests", "Login", 0);
JMeterTransactions jmeterTransactions = new JMeterTransactions();
jmeterTransactions.add(TestData.LOGIN_1200_FAILURE);
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 PassedTransactionsTestTest method testPrintTestExecutionReportPassNoTransactionName.
@Test
public void testPrintTestExecutionReportPassNoTransactionName() {
String expectedOutput = String.format("Test name: Test #1%n" + "Test type: passedTransactionsTest%n" + "Test description: Verify number of passed tests%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", "Verify number of passed tests", null, 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 RespTimeMedianTestTest method verifyExecuteError.
@Test
public void verifyExecuteError() {
RespTimeMedianTest test = new RespTimeMedianTest("Test #1", "medianRespTimeTest", "Verify median", "nonexistent", 800);
JMeterTransactions jmeterTransactions = new JMeterTransactions();
jmeterTransactions.add(TestData.SEARCH_11221_SUCCESS);
test.execute(jmeterTransactions);
assertThat(test.getResult(), is(equalTo(TestResult.ERROR)));
}
Aggregations