use of io.github.sskorol.listeners.InvokedMethodNameListener in project selenium_java by sergueik.
the class BaseTest method run.
static InvokedMethodNameListener run(final Class<?>... testClasses) {
final TestNG tng = create(testClasses);
final InvokedMethodNameListener listener = new InvokedMethodNameListener();
final DataProviderTransformer dataProviderTransformer = new DataProviderTransformer();
tng.addListener((ITestNGListener) listener);
tng.addListener(dataProviderTransformer);
tng.setDefaultTestName("DataSupplier tests");
tng.run();
return listener;
}
use of io.github.sskorol.listeners.InvokedMethodNameListener 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 io.github.sskorol.listeners.InvokedMethodNameListener in project selenium_java by sergueik.
the class DataSupplierTests method tupleDataSupplierTestsShouldWork.
@Test
public void tupleDataSupplierTestsShouldWork() {
final InvokedMethodNameListener listener = run(TupleDataSupplierTests.class);
assertThat(listener.getSucceedMethodNames()).hasSize(4).containsExactly("supplyCommonTupleData(data1)", "supplyCommonTupleData(data2)", "supplyExternalTupleData(1,2,3.0)", "supplyExtractedTupleData(1,User(name=name, password=password))");
}
use of io.github.sskorol.listeners.InvokedMethodNameListener 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 io.github.sskorol.listeners.InvokedMethodNameListener in project selenium_java by sergueik.
the class DataSupplierTests method singleObjectDataSuppliersShouldWork.
@Test
public void singleObjectDataSuppliersShouldWork() {
final InvokedMethodNameListener listener = run(SingleObjectsDataSupplierTests.class);
assertThat(listener.getSucceedMethodNames()).hasSize(4).containsExactly("supplyCommonObject(data1)", "supplyCustomObjectData(User(name=username, password=password))", "supplyExternalObjectData(0.1)", "supplyPrimitiveData(5)");
}
Aggregations