use of uk.co.automatictester.lightning.utils.Percent in project lightning by automatictester.
the class LightningXMLFileReader method addPassedTransactionsTestNodes.
protected void addPassedTransactionsTestNodes(Document xmlDoc) {
String testType = "passedTransactionsTest";
NodeList passedTransactionsTestNodes = xmlDoc.getElementsByTagName(testType);
for (int i = 0; i < passedTransactionsTestNodes.getLength(); i++) {
Element passedTransactionsElement = (Element) passedTransactionsTestNodes.item(i);
String name = getTestName(passedTransactionsElement);
String description = getTestDescription(passedTransactionsElement);
String transactionName = getTransactionName(passedTransactionsElement);
int allowedNumberOfFailedTransactions;
int allowedPercentOfFailedTransactions;
PassedTransactionsTest passedTransactionsTest;
if (isSubElementPresent(passedTransactionsElement, "allowedNumberOfFailedTransactions")) {
allowedNumberOfFailedTransactions = getIntegerValueFromElement(passedTransactionsElement, "allowedNumberOfFailedTransactions");
passedTransactionsTest = new PassedTransactionsTest(name, testType, description, transactionName, allowedNumberOfFailedTransactions);
} else {
allowedPercentOfFailedTransactions = getPercent(passedTransactionsElement, "allowedPercentOfFailedTransactions");
passedTransactionsTest = new PassedTransactionsTest(name, testType, description, transactionName, new Percent(allowedPercentOfFailedTransactions));
}
passedTransactionsTest.setRegexp(isSubElementPresent(passedTransactionsElement, "regexp"));
clientSideTests.add(passedTransactionsTest);
}
}
use of uk.co.automatictester.lightning.utils.Percent 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.utils.Percent in project lightning by automatictester.
the class LightningXMLFileReaderTest method verifyGetTestsMethodPassedPercentTest.
@Test
public void verifyGetTestsMethodPassedPercentTest() {
LightningXMLFileReader xmlFileReader = new LightningXMLFileReader();
xmlFileReader.readTests(TEST_SET_PASSED_PERCENT);
List<ClientSideTest> tests = xmlFileReader.getClientSideTests();
PassedTransactionsTest test = new PassedTransactionsTest("Test #3", "passedTransactionsTest", "Verify percent of passed tests", "Login", new Percent(0));
assertThat(tests, hasSize(1));
assertThat(tests.contains(test), is(true));
}
use of uk.co.automatictester.lightning.utils.Percent 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"));
}
Aggregations