use of org.testng.ITestResult in project selenium_java by sergueik.
the class DataSupplierTests method dataSuppliersWithInjectedArgsShouldWork.
@Test
public void dataSuppliersWithInjectedArgsShouldWork() {
final InvokedMethodNameListener listener = run(InjectedArgsDataSupplierTests.class);
assertThat(listener.getSucceedMethodNames()).hasSize(4).containsExactly("supplyContextMetaData(DataSupplier tests)", "supplyFullMetaData(DataSupplier tests,supplyFullMetaData)", "supplyMethodMetaData(supplyMethodMetaData)", "supplyWrongArgTypeMethodMetaData(data)");
assertThat(listener.getSkippedBeforeInvocationMethodNames()).hasSize(1).containsExactly("supplyNullArgTypeMethodMetaData()");
assertThat(EntryStream.of(listener.getResults()).values().toList()).filteredOn(r -> r.getStatus() == ITestResult.SKIP).extracting(ITestResult::getThrowable).extracting(Throwable::getMessage).containsExactly("java.lang.IllegalArgumentException: Nothing to return from data supplier. The following test will be skipped: InjectedArgsDataSupplierTests.supplyNullArgTypeMethodMetaData.");
}
use of org.testng.ITestResult in project selenium_java by sergueik.
the class DataSupplierTests method missingDataSuppliersShouldNotWork.
@Test
public void missingDataSuppliersShouldNotWork() {
final InvokedMethodNameListener listener = run(MissingDataSupplierTests.class);
assertThat(listener.getFailedBeforeInvocationMethodNames()).hasSize(2).containsExactly("failOnDataSupplying()", "failOnExternalDataSupplying()");
assertThat(EntryStream.of(listener.getResults()).values().toList()).extracting(ITestResult::getThrowable).extracting(t -> t.getMessage().trim()).containsExactly("Method public void io.github.sskorol.testcases.MissingDataSupplierTests.failOnDataSupplying() requires a @DataProvider named : missingDataSupplier", "Method public void io.github.sskorol.testcases.MissingDataSupplierTests.failOnExternalDataSupplying() requires a @DataProvider named : missingExternalDataSupplier in class io.github.sskorol.datasuppliers.ExternalDataSuppliers");
}
use of org.testng.ITestResult in project carina by qaprosoft.
the class AbstractTestListener method printContextTestsSummary.
@SuppressWarnings("unused")
private void printContextTestsSummary(ITestContext context) {
LOGGER.debug("getAllTestMethods length: " + context.getAllTestMethods().length);
LOGGER.debug("---------------- PRINT SUMMARIZED SUCCESS -----------------------");
// print messages about all tests in context
LOGGER.debug("passed tests size: " + context.getPassedTests().getAllResults().size());
for (Iterator<ITestResult> iterator = context.getPassedTests().getAllResults().iterator(); iterator.hasNext(); ) {
ITestResult testResult = iterator.next();
long testId = getMethodId(testResult);
LOGGER.debug("Pass test in context: " + testId + "; " + testResult.getName());
}
LOGGER.debug("---------------- PRINT SUMMARIZED FAILURE -----------------------");
// print messages about all tests in context
LOGGER.debug("failed tests size: " + context.getFailedTests().getAllResults().size());
for (Iterator<ITestResult> iterator = context.getFailedTests().getAllResults().iterator(); iterator.hasNext(); ) {
ITestResult testResult = iterator.next();
long testId = getMethodId(testResult);
LOGGER.debug("Failed test in context: " + testId + "; " + testResult.getName());
}
LOGGER.debug("---------------- PRINT SUMMARIZED SKIP -----------------------");
// print messages about all tests in context
LOGGER.debug("skipped tests size: " + context.getSkippedTests().getAllResults().size());
for (Iterator<ITestResult> iterator = context.getSkippedTests().getAllResults().iterator(); iterator.hasNext(); ) {
ITestResult testResult = iterator.next();
long testId = getMethodId(testResult);
LOGGER.debug("Skipped test in context: " + testId + "; " + testResult.getName());
}
LOGGER.debug("---------------- PRINT SUMMARIZED CONFIGURATION SUCCESS -----------------------");
LOGGER.debug("passed configurations size: " + context.getPassedConfigurations().getAllResults().size());
for (Iterator<ITestResult> iterator = context.getPassedConfigurations().getAllResults().iterator(); iterator.hasNext(); ) {
ITestResult testResult = iterator.next();
long testId = getMethodId(testResult);
LOGGER.debug("passed configurations in context: " + testId + "; " + testResult.getName());
}
LOGGER.debug("---------------- PRINT SUMMARIZED CONFIGURATION FAILURE -----------------------");
LOGGER.debug("failed configurations size: " + context.getFailedConfigurations().getAllResults().size());
for (Iterator<ITestResult> iterator = context.getFailedConfigurations().getAllResults().iterator(); iterator.hasNext(); ) {
ITestResult testResult = iterator.next();
long testId = getMethodId(testResult);
LOGGER.debug("failed configurations in context: " + testId + "; " + testResult.getName());
}
LOGGER.debug("---------------- PRINT SUMMARIZED CONFIGURATION SKIP -----------------------");
LOGGER.debug("skipped configurations size: " + context.getSkippedConfigurations().getAllResults().size());
for (Iterator<ITestResult> iterator = context.getSkippedConfigurations().getAllResults().iterator(); iterator.hasNext(); ) {
ITestResult testResult = iterator.next();
long testId = getMethodId(testResult);
LOGGER.debug("failed configurations in context: " + testId + "; " + testResult.getName());
}
}
use of org.testng.ITestResult in project arrow by NetEase.
the class NeXMLSuiteResultWriter method writeAllToBuffer.
private void writeAllToBuffer(XMLStringBuffer xmlBuffer, ISuiteResult suiteResult) {
xmlBuffer.push(NeXMLReporterConfig.TAG_TEST, getSuiteResultAttributes(suiteResult));
Set<ITestResult> testResults = Sets.newHashSet();
ITestContext testContext = suiteResult.getTestContext();
addAllTestResults(testResults, testContext.getPassedTests());
addAllTestResults(testResults, testContext.getFailedTests());
addAllTestResults(testResults, testContext.getSkippedTests());
addAllTestResults(testResults, testContext.getPassedConfigurations());
addAllTestResults(testResults, testContext.getSkippedConfigurations());
addAllTestResults(testResults, testContext.getFailedConfigurations());
addAllTestResults(testResults, testContext.getFailedButWithinSuccessPercentageTests());
addTestResults(xmlBuffer, testResults);
xmlBuffer.pop();
}
use of org.testng.ITestResult in project arrow by NetEase.
the class NeXMLSuiteResultWriter method addAllTestResults.
@SuppressWarnings("unchecked")
private void addAllTestResults(Set<ITestResult> testResults, IResultMap resultMap) {
if (resultMap != null) {
// Sort the results chronologically before adding them
List<ITestResult> allResults = new ArrayList<>();
allResults.addAll(resultMap.getAllResults());
Collections.sort(new ArrayList(allResults), new Comparator<ITestResult>() {
@Override
public int compare(ITestResult o1, ITestResult o2) {
return (int) (o1.getStartMillis() - o2.getStartMillis());
}
});
testResults.addAll(allResults);
}
}
Aggregations