Skip to content

Commit

Permalink
Refactored to use Gherkin 6 / Protobuf.
Browse files Browse the repository at this point in the history
Removed JSON/HTML/Pretty/JUnit XML formatters and related cruft.

See:
* cucumber/common#416
* cucumber/common#415
  • Loading branch information
aslakhellesoy committed Jun 21, 2018
1 parent 6e10f47 commit 46ce2a0
Show file tree
Hide file tree
Showing 124 changed files with 1,178 additions and 8,576 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,43 @@
import android.app.Instrumentation;
import android.content.Context;
import android.util.Log;
import cucumber.api.TypeRegistryConfigurer;
import cucumber.api.CucumberOptions;
import cucumber.api.StepDefinitionReporter;
import cucumber.api.TypeRegistryConfigurer;
import cucumber.api.event.TestRunFinished;
import cucumber.api.event.TestRunStarted;
import cucumber.api.java.ObjectFactory;
import cucumber.messages.Pickles.Pickle;
import cucumber.runner.EventBus;
import cucumber.runner.Runner;
import cucumber.runner.TimeService;
import cucumber.runtime.BackendSupplier;
import cucumber.runtime.FeaturePathFeatureSupplier;
import cucumber.runtime.filter.Filters;
import cucumber.runtime.formatter.Plugins;
import cucumber.runtime.filter.RerunFilters;
import cucumber.runtime.formatter.PluginFactory;
import cucumber.runtime.model.FeatureLoader;
import cucumber.runtime.ThreadLocalRunnerSupplier;
import cucumber.runtime.RuntimeGlueSupplier;
import io.cucumber.stepexpression.TypeRegistry;
import cucumber.api.event.TestRunFinished;
import cucumber.api.java.ObjectFactory;
import cucumber.runtime.Backend;
import cucumber.runtime.BackendSupplier;
import cucumber.runtime.ClassFinder;
import cucumber.runtime.CucumberException;
import cucumber.runtime.DefaultTypeRegistryConfiguration;
import cucumber.runtime.Env;
import cucumber.runtime.FeaturePathFeatureSupplier;
import cucumber.runtime.Reflections;
import cucumber.runtime.RuntimeGlueSupplier;
import cucumber.runtime.RuntimeOptions;
import cucumber.runtime.RuntimeOptionsFactory;
import cucumber.runtime.formatter.Stats;
import cucumber.runtime.ThreadLocalRunnerSupplier;
import cucumber.runtime.UndefinedStepsTracker;
import cucumber.runtime.formatter.AndroidInstrumentationReporter;
import cucumber.runtime.filter.Filters;
import cucumber.runtime.filter.RerunFilters;
import cucumber.runtime.formatter.AndroidLogcatReporter;
import cucumber.runtime.formatter.PluginFactory;
import cucumber.runtime.formatter.Plugins;
import cucumber.runtime.formatter.Stats;
import cucumber.runtime.io.MultiLoader;
import cucumber.runtime.io.ResourceLoader;
import cucumber.runtime.java.JavaBackend;
import cucumber.runtime.java.ObjectFactoryLoader;
import cucumber.runtime.model.CucumberFeature;
import cucumber.runtime.model.FeatureLoader;
import dalvik.system.DexFile;
import gherkin.events.PickleEvent;
import io.cucumber.stepexpression.TypeRegistry;

import java.io.IOException;
import java.util.Collection;
Expand Down Expand Up @@ -78,7 +77,7 @@ public final class CucumberExecutor {
*/
private final RuntimeOptions runtimeOptions;

private final List<PickleEvent> pickleEvents;
private final List<Pickle> pickleEvents;
private final EventBus bus;
private final Plugins plugins;
private final Runner runner;
Expand Down Expand Up @@ -114,8 +113,6 @@ public CucumberExecutor(final Arguments arguments, final Instrumentation instrum
Stats stats = new Stats();
stats.setEventPublisher(bus);

AndroidInstrumentationReporter instrumentationReporter = new AndroidInstrumentationReporter(undefinedStepsTracker, instrumentation);
plugins.addPlugin(instrumentationReporter);
plugins.addPlugin(new AndroidLogcatReporter(stats, undefinedStepsTracker, TAG));

// Start the run before reading the features.
Expand All @@ -126,7 +123,6 @@ public CucumberExecutor(final Arguments arguments, final Instrumentation instrum
feature.sendTestSourceRead(bus);
}
this.pickleEvents = FeatureCompiler.compile(features, filters);
instrumentationReporter.setNumberOfTests(getNumberOfConcreteScenarios());
}

/**
Expand All @@ -135,7 +131,7 @@ public CucumberExecutor(final Arguments arguments, final Instrumentation instrum
public void execute() {
final StepDefinitionReporter stepDefinitionReporter = plugins.stepDefinitionReporter();
runner.reportStepDefinitions(stepDefinitionReporter);
for (final PickleEvent pickleEvent : pickleEvents) {
for (final Pickle pickleEvent : pickleEvents) {
runner.runPickle(pickleEvent);
}
bus.send(new TestRunFinished(bus.getTime()));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package cucumber.runtime.android;

import cucumber.messages.Pickles.Pickle;
import cucumber.runtime.filter.Filters;
import cucumber.runtime.model.CucumberFeature;
import gherkin.events.PickleEvent;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -13,18 +13,18 @@
final class FeatureCompiler {

/**
* Compilers the given {@code cucumberFeatures} to {@link PickleEvent}s.
* Compilers the given {@code cucumberFeatures} to {@link Pickle}s.
*
* @param cucumberFeatures the list of {@link CucumberFeature} to compile
* @return the compiled pickles in {@link PickleEvent}s
* @return the compiled pickles in {@link Pickle}s
*/
static List<PickleEvent> compile(final List<CucumberFeature> cucumberFeatures, final Filters filters) {
List<PickleEvent> pickles = new ArrayList<PickleEvent>();
static List<Pickle> compile(final List<CucumberFeature> cucumberFeatures, final Filters filters) {
List<Pickle> pickles = new ArrayList<Pickle>();
cucumber.runtime.FeatureCompiler compiler = new cucumber.runtime.FeatureCompiler();
for (final CucumberFeature feature : cucumberFeatures) {
for (final PickleEvent pickleEvent : compiler.compileFeature(feature)) {
if (filters.matchesFilters(pickleEvent)) {
pickles.add(pickleEvent);
for (final Pickle pickle : compiler.compileFeature(feature)) {
if (filters.matchesFilters(pickle)) {
pickles.add(pickle);
}
}
}
Expand Down
Loading

0 comments on commit 46ce2a0

Please sign in to comment.