Skip to content

Commit

Permalink
Reorganization of integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
koryl committed Aug 21, 2018
1 parent 9852ae7 commit e56611d
Show file tree
Hide file tree
Showing 30 changed files with 44 additions and 336 deletions.
Expand Up @@ -50,6 +50,13 @@ public class FluentCucumber extends ParentRunner<FeatureRunner> {
private final ClassFinder classFinder;
private final RuntimeOptions runtimeOptions;

/**
* Constructor for FluentCucumber.
*
* @param clazz runner class
* @throws InitializationError problem with initialization
* @throws IOException problem with reading feature files
*/
public FluentCucumber(Class clazz) throws InitializationError, IOException {
super(clazz);
ClassLoader classLoader = clazz.getClassLoader();
Expand Down Expand Up @@ -78,9 +85,12 @@ public FluentCucumber(Class clazz) throws InitializationError, IOException {
*/
private JavaBackend getBackend() {
Reflections reflections = new Reflections(classFinder);
TypeRegistryConfigurer typeRegistryConfigurer = reflections.instantiateExactlyOneSubclass(TypeRegistryConfigurer.class,
MultiLoader.packageName(runtimeOptions.getGlue()),
new Class[0], new Object[0], new DefaultTypeRegistryConfiguration());
TypeRegistryConfigurer typeRegistryConfigurer =
reflections.instantiateExactlyOneSubclass(TypeRegistryConfigurer.class,
MultiLoader.packageName(runtimeOptions.getGlue()),
new Class[0],
new Object[0],
new DefaultTypeRegistryConfiguration());

FLUENT_TEST.instance();

Expand Down Expand Up @@ -115,13 +125,17 @@ protected Description describeChild(FeatureRunner child) {

/**
* Run feature.
*
* @param child FeatureRunner child
* @param notifier notifier used by Cucumber
*/
protected void runChild(FeatureRunner child, RunNotifier notifier) {
child.run(notifier);
}

/**
* Invoke feature
*
* @param notifier notifier
* @return evaluated Statement
*/
Expand All @@ -130,7 +144,10 @@ protected Statement childrenInvoker(RunNotifier notifier) {
return new Statement() {
public void evaluate() throws Throwable {
features.evaluate();
FluentCucumber.this.runtime.getEventBus().send(new TestRunFinished(FluentCucumber.this.runtime.getEventBus().getTime()));
runtime.getEventBus()
.send(new TestRunFinished
(runtime.getEventBus()
.getTime()));
}
};
}
Expand Down
Expand Up @@ -3,10 +3,10 @@
import cucumber.api.java.ObjectFactory;
import cucumber.runtime.CucumberException;


import java.util.HashMap;
import java.util.Map;

import static java.util.Objects.isNull;
import static org.fluentlenium.adapter.cucumber.FluentCucumberTestContainer.FLUENT_TEST;

/**
Expand All @@ -18,7 +18,10 @@ public class FluentObjectFactory implements ObjectFactory {

private final Map<Class<?>, Object> instances = new HashMap<>();

public FluentObjectFactory() {
/**
* Creating instance of FluentObhectFactory and sets FluentCucumberTest instance.
*/
FluentObjectFactory() {
this.fluentTest = FLUENT_TEST.instance();
}

Expand All @@ -38,12 +41,11 @@ public boolean addClass(Class<?> aClass) {
return true;
}

@SuppressWarnings("unchecked")
@Override
public <T> T getInstance(Class<T> type) {
try {
T instance = type.cast(instances.get(type));
if (instance == null) {
if (isNull(instance)) {
instance = cacheNewInstance(type);
}
return instance;
Expand Down
Expand Up @@ -7,7 +7,8 @@
import org.junit.runner.RunWith;

@RunWith(FluentCucumber.class)
@CucumberOptions(features = "classpath:org/fluentlenium/adapter/cucumber/integration",
@CucumberOptions(features = "classpath:org/fluentlenium/adapter/cucumber/integration/scenario",
glue = "org.fluentlenium.adapter.cucumber.integration.configuration.steps",
plugin = {"pretty", "html:target/cucumber", "json:target/cucumber.json"})
@FluentConfiguration(webDriver = "htmlunit")
@NotThreadSafe
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Expand Up @@ -7,7 +7,8 @@
import org.junit.runner.RunWith;

@RunWith(FluentCucumber.class)
@CucumberOptions(features = "classpath:org/fluentlenium/adapter/cucumber/integration",
@CucumberOptions(features = "classpath:org/fluentlenium/adapter/cucumber/integration/scenario",
glue = "org.fluentlenium.adapter.cucumber.integration.configuration.steps",
plugin = {"pretty", "html:target/cucumber", "json:target/cucumber.json"})
@FluentConfiguration(configurationDefaults = TestConfiguration.class)
@NotThreadSafe
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Expand Up @@ -8,6 +8,7 @@

@RunWith(FluentCucumber.class)
@CucumberOptions(features = "classpath:org/fluentlenium/adapter/cucumber/integration/scenario",
glue = "org.fluentlenium.adapter.cucumber.integration.configuration.steps",
plugin = {"pretty", "html:target/cucumber", "json:target/cucumber.json"})
@FluentConfiguration(webDriver = "htmlunit")
@NotThreadSafe
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit e56611d

Please sign in to comment.