Search in sources :

Example 1 with SystemUnderTest

use of org.activityinfo.test.sut.SystemUnderTest in project activityinfo by bedatadriven.

the class TestMain method queueTestMethods.

private void queueTestMethods(String environment, Module... driverModules) {
    List<Module> modules = new ArrayList<>();
    modules.add(new SystemUnderTest(url));
    modules.add(new EmailModule());
    modules.addAll(Arrays.asList(driverModules));
    TestConditions conditions = new TestConditions(environment, modules);
    Predicate<String> filter = filterPredicate();
    ClassLoader classLoader = getClass().getClassLoader();
    ClassFinder classFinder = new ResourceLoaderClassFinder(new MultiLoader(classLoader), classLoader);
    Collection<Class<?>> testClasses = classFinder.getDescendants(Object.class, "org.activityinfo.test.ui");
    for (Class<?> testClass : testClasses) {
        for (Method method : JUnitUiTestCase.findTestMethods(testClass)) {
            if (filter.apply(method.getName()) || filter.apply(method.getDeclaringClass().getName())) {
                queueTestCase(new JUnitUiTestCase(method, conditions));
            }
        }
    }
}
Also used : MultiLoader(cucumber.runtime.io.MultiLoader) Method(java.lang.reflect.Method) EmailModule(org.activityinfo.test.driver.mail.EmailModule) ResourceLoaderClassFinder(cucumber.runtime.io.ResourceLoaderClassFinder) SystemUnderTest(org.activityinfo.test.sut.SystemUnderTest) ResourceLoaderClassFinder(cucumber.runtime.io.ResourceLoaderClassFinder) ClassFinder(cucumber.runtime.ClassFinder) OdkModule(org.activityinfo.test.webdriver.OdkModule) Module(com.google.inject.Module) ApiModule(org.activityinfo.test.driver.ApiModule) WebDriverModule(org.activityinfo.test.webdriver.WebDriverModule) EmailModule(org.activityinfo.test.driver.mail.EmailModule)

Example 2 with SystemUnderTest

use of org.activityinfo.test.sut.SystemUnderTest in project activityinfo by bedatadriven.

the class TestMain method queueFeatures.

private void queueFeatures(String environment, ResourceLoader loader, RuntimeOptions options, Module... driverModules) {
    List<Module> modules = new ArrayList<>();
    modules.add(new SystemUnderTest(url));
    modules.add(new EmailModule());
    modules.addAll(Arrays.asList(driverModules));
    TestConditions conditions = new TestConditions(environment, modules);
    Predicate<String> filter = filterPredicate();
    List<CucumberFeature> features = options.cucumberFeatures(loader);
    for (CucumberFeature feature : features) {
        for (CucumberTagStatement element : feature.getFeatureElements()) {
            if (filter.apply(feature.getPath()) || filter.apply(element.getVisualName())) {
                ScenarioTestCase testCase = new ScenarioTestCase(options, feature, element, conditions);
                queueTestCase(testCase);
            }
        }
    }
}
Also used : CucumberFeature(cucumber.runtime.model.CucumberFeature) SystemUnderTest(org.activityinfo.test.sut.SystemUnderTest) CucumberTagStatement(cucumber.runtime.model.CucumberTagStatement) OdkModule(org.activityinfo.test.webdriver.OdkModule) Module(com.google.inject.Module) ApiModule(org.activityinfo.test.driver.ApiModule) WebDriverModule(org.activityinfo.test.webdriver.WebDriverModule) EmailModule(org.activityinfo.test.driver.mail.EmailModule) EmailModule(org.activityinfo.test.driver.mail.EmailModule) ScenarioTestCase(org.activityinfo.test.cucumber.ScenarioTestCase)

Aggregations

Module (com.google.inject.Module)2 ApiModule (org.activityinfo.test.driver.ApiModule)2 EmailModule (org.activityinfo.test.driver.mail.EmailModule)2 SystemUnderTest (org.activityinfo.test.sut.SystemUnderTest)2 OdkModule (org.activityinfo.test.webdriver.OdkModule)2 WebDriverModule (org.activityinfo.test.webdriver.WebDriverModule)2 ClassFinder (cucumber.runtime.ClassFinder)1 MultiLoader (cucumber.runtime.io.MultiLoader)1 ResourceLoaderClassFinder (cucumber.runtime.io.ResourceLoaderClassFinder)1 CucumberFeature (cucumber.runtime.model.CucumberFeature)1 CucumberTagStatement (cucumber.runtime.model.CucumberTagStatement)1 Method (java.lang.reflect.Method)1 ScenarioTestCase (org.activityinfo.test.cucumber.ScenarioTestCase)1