Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: cucumber/cucumber-jvm
...
head fork: cucumber/cucumber-jvm
  • 17 commits
  • 49 files changed
  • 0 commit comments
  • 3 contributors
Showing with 211 additions and 99 deletions.
  1. +9 −0 History.md
  2. +1 −1  clojure/pom.xml
  3. +4 −1 clojure/src/main/java/cucumber/runtime/clojure/ClojureHookDefinition.java
  4. +3 −0  clojure/src/test/resources/cucumber/runtime/clojure/stepdefs.clj
  5. +1 −5 core/pom.xml
  6. +18 −14 core/src/main/java/cucumber/cli/Main.java
  7. +9 −1 core/src/main/java/cucumber/formatter/FormatterFactory.java
  8. +7 −3 core/src/main/java/cucumber/formatter/HTMLFormatter.java
  9. +3 −4 core/src/main/java/cucumber/formatter/MultiFormatter.java
  10. +4 −0 core/src/main/java/cucumber/formatter/NullReporter.java
  11. +5 −0 core/src/main/java/cucumber/formatter/ProgressFormatter.java
  12. +4 −0 core/src/main/java/cucumber/runtime/FeatureBuilder.java
  13. +1 −1  core/src/main/java/cucumber/runtime/Runtime.java
  14. +2 −2 core/src/main/java/cucumber/runtime/RuntimeGlue.java
  15. +2 −2 core/src/main/java/cucumber/runtime/model/CucumberScenario.java
  16. +2 −2 core/src/main/java/cucumber/runtime/model/CucumberScenarioOutline.java
  17. +1 −1  core/src/main/java/cucumber/runtime/model/CucumberTagStatement.java
  18. +1 −2  core/src/main/java/cucumber/runtime/model/StepContainer.java
  19. +0 −8 core/src/main/java/cucumber/runtime/model/StepRunner.java
  20. +7 −1 core/src/test/java/cucumber/formatter/FormatterFactoryTest.java
  21. +1 −0  core/src/test/java/cucumber/formatter/HTMLFormatterTest.java
  22. +5 −0 core/src/test/java/cucumber/formatter/TestFormatter.java
  23. +1 −1  core/src/test/java/cucumber/runtime/HookTest.java
  24. +52 −3 core/src/test/java/cucumber/runtime/RuntimeTest.java
  25. +2 −2 core/src/test/java/cucumber/runtime/autocomplete/StepdefGeneratorTest.java
  26. +1 −1  groovy/pom.xml
  27. +1 −1  guice/pom.xml
  28. +1 −1  ioke/pom.xml
  29. +1 −1  java/pom.xml
  30. +0 −2  java/src/test/java/cucumber/runtime/java/JavaBackendTest.java
  31. +1 −1  jruby/pom.xml
  32. +10 −1 jruby/src/test/resources/cucumber/runtime/jruby/test/cukes.feature
  33. +12 −0 jruby/src/test/resources/cucumber/runtime/jruby/test/stepdefs.rb
  34. +1 −1  junit/pom.xml
  35. +1 −0  junit/src/main/java/cucumber/junit/Cucumber.java
  36. +6 −9 junit/src/main/java/cucumber/junit/ExecutionUnitRunner.java
  37. +9 −6 junit/src/main/java/cucumber/junit/JUnitReporter.java
  38. +1 −1  jython/pom.xml
  39. +1 −1  openejb/pom.xml
  40. +1 −1  openejb/src/test/java/cucumber/runtime/java/openejb/{CDIFactoryTest.java → OpenEJBObjectFactoryTest.java}
  41. +7 −0 openejb/src/test/resources/META-INF/beans.xml
  42. +1 −1  picocontainer/pom.xml
  43. +4 −10 pom.xml
  44. +1 −1  rhino/pom.xml
  45. +1 −1  scala/pom.xml
  46. +1 −1  spring/pom.xml
  47. +1 −1  weld/pom.xml
  48. +1 −1  weld/src/main/java/cucumber/runtime/java/weld/{CDIFactory.java → WeldFactory.java}
  49. +2 −2 weld/src/test/java/cucumber/runtime/java/weld/{CDIFactoryTest.java → WeldFactoryTest.java}
9 History.md
View
@@ -1,3 +1,12 @@
+## In Git
+
+* [Clojure] Fixed hooks ([#175](https://github.com/cucumber/cucumber-jvm/pull/175) Ronaldo M. Ferraz)
+* [Core] Properly flush and close formatters ([#173](https://github.com/cucumber/cucumber-jvm/pull/173) Aslak Hellesøy, David Kowis)
+* [Core] Use Gherkin's internal Gson (Aslak Hellesøy)
+* [JUnit] Better reporting of Before and After blocks (Aslak Hellesøy)
+* [Core] Bugfix: Scenario Outlines failing ([#170](https://github.com/cucumber/cucumber-jvm/issues/170) David Kowis, Aslak Hellesøy)
+* [OpenEJB] It's back (was excluded from previous releases because it depended on unreleased libs). (Aslak Hellesøy)
+
## [1.0.0.RC12](https://github.com/cucumber/cucumber-jvm/compare/v1.0.0.RC11...v1.0.0.RC12)
* [JUnit] Tagged hooks are executed properly (Aslak Hellesøy)
2  clojure/pom.xml
View
@@ -5,7 +5,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC12</version>
+ <version>1.0.0.RC13</version>
</parent>
<artifactId>cucumber-clojure</artifactId>
5 clojure/src/main/java/cucumber/runtime/clojure/ClojureHookDefinition.java
View
@@ -9,6 +9,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Collection;
+import java.util.List;
import static java.util.Arrays.asList;
@@ -24,7 +25,9 @@ public ClojureHookDefinition(String[] tagExpressions, IFn closure) {
// Clojure's AFunction.invokeWithArgs doesn't take varargs :-/
private Method lookupInvokeMethod(Object[] args) throws NoSuchMethodException {
- return IFn.class.getMethod("invoke", (Class<?>[]) Utils.listOf(args.length, String.class).toArray());
+ List<Class<Object>> classes = Utils.listOf(args.length, Object.class);
+ Class<?>[] params = classes.toArray(new Class<?>[classes.size()]);
+ return IFn.class.getMethod("invoke", params);
}
@Override
3  clojure/src/test/resources/cucumber/runtime/clojure/stepdefs.clj
View
@@ -1,5 +1,8 @@
(use 'cucumber.runtime.clojure.belly)
+(Before)
+(After)
+
(Given #"^I have (\d+) cukes in my belly$"
#(eat (Float. %1)))
6 core/pom.xml
View
@@ -5,7 +5,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC12</version>
+ <version>1.0.0.RC13</version>
</parent>
<artifactId>cucumber-core</artifactId>
@@ -26,10 +26,6 @@
<artifactId>diffutils</artifactId>
</dependency>
<dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- </dependency>
- <dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-html</artifactId>
</dependency>
32 core/src/main/java/cucumber/cli/Main.java
View
@@ -13,6 +13,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.ResourceBundle;
+import java.util.Stack;
import static java.util.Arrays.asList;
@@ -28,12 +29,12 @@ public static void run(String[] argv, ClassLoader classLoader, RuntimeFactory ru
List<String> featurePaths = new ArrayList<String>();
List<String> gluePaths = new ArrayList<String>();
List<Object> filters = new ArrayList<Object>();
- String format = "progress";
+ Stack<String> format = new Stack<String>();
List<String> args = new ArrayList<String>(asList(argv));
String dotCucumber = null;
boolean isDryRun = false;
- FormatterFactory formatterFactory = new FormatterFactory();
+ FormatterFactory formatterFactory = new FormatterFactory(classLoader);
MultiFormatter multiFormatter = new MultiFormatter(classLoader);
while (!args.isEmpty()) {
@@ -51,10 +52,10 @@ public static void run(String[] argv, ClassLoader classLoader, RuntimeFactory ru
} else if (arg.equals("--tags") || arg.equals("-t")) {
filters.add(args.remove(0));
} else if (arg.equals("--format") || arg.equals("-f")) {
- format = args.remove(0);
+ format.push(args.remove(0));
} else if (arg.equals("--out") || arg.equals("-o")) {
File out = new File(args.remove(0));
- Formatter formatter = formatterFactory.createFormatter(format, out);
+ Formatter formatter = formatterFactory.createFormatter(format.pop(), out);
multiFormatter.add(formatter);
} else if (arg.equals("--dotcucumber")) {
dotCucumber = args.remove(0);
@@ -66,8 +67,14 @@ public static void run(String[] argv, ClassLoader classLoader, RuntimeFactory ru
}
}
- if (multiFormatter.isEmpty()) {
- multiFormatter.add(formatterFactory.createFormatter(format, System.out));
+ //Grab any formatters left on the stack and create a multiformatter for them to stdout
+ // yes this will be ugly, but maybe people are crazy
+ if (!format.isEmpty()) {
+ multiFormatter.add(formatterFactory.createFormatter(format.pop(), System.out));
+ } else {
+ //Default formatter is progress unless otherwise specified or if they have piped all their other formatters
+ // to an output thing
+ multiFormatter.add(formatterFactory.createFormatter("progress", System.out));
}
if (gluePaths.isEmpty()) {
@@ -80,8 +87,12 @@ public static void run(String[] argv, ClassLoader classLoader, RuntimeFactory ru
if (dotCucumber != null) {
writeDotCucumber(featurePaths, dotCucumber, runtime);
}
- run(featurePaths, filters, multiFormatter, runtime);
+ Formatter formatter = multiFormatter.formatterProxy();
+ Reporter reporter = multiFormatter.reporterProxy();
+ runtime.run(featurePaths, filters, formatter, reporter);
+ formatter.done();
printSummary(runtime);
+ formatter.close();
System.exit(runtime.exitStatus());
}
@@ -91,13 +102,6 @@ private static void writeDotCucumber(List<String> featurePaths, String dotCucumb
runtime.writeStepdefsJson(featurePaths, dotCucumber);
}
- private static void run(List<String> featurePaths, List<Object> filters, MultiFormatter multiFormatter, Runtime runtime) throws IOException {
- Formatter formatter = multiFormatter.formatterProxy();
- Reporter reporter = multiFormatter.reporterProxy();
- runtime.run(featurePaths, filters, formatter, reporter);
- formatter.done();
- }
-
private static void printSummary(Runtime runtime) {
new SummaryPrinter(System.out).print(runtime);
}
10 core/src/main/java/cucumber/formatter/FormatterFactory.java
View
@@ -3,6 +3,7 @@
import cucumber.runtime.CucumberException;
import gherkin.formatter.Formatter;
import gherkin.formatter.JSONFormatter;
+import gherkin.formatter.JSONPrettyFormatter;
import gherkin.formatter.PrettyFormatter;
import java.io.File;
@@ -12,13 +13,20 @@
public class FormatterFactory {
+ private final ClassLoader classLoader;
+
private static final Map<String, String> BUILTIN_FORMATTERS = new HashMap<String, String>() {{
put("progress", ProgressFormatter.class.getName());
put("html", HTMLFormatter.class.getName());
put("json", JSONFormatter.class.getName());
+ put("json-pretty", JSONPrettyFormatter.class.getName());
put("pretty", PrettyFormatter.class.getName());
}};
+ public FormatterFactory(ClassLoader classLoader) {
+ this.classLoader = classLoader;
+ }
+
public Formatter createFormatter(String formatterName, Object out) {
String className = BUILTIN_FORMATTERS.containsKey(formatterName) ? BUILTIN_FORMATTERS.get(formatterName) : formatterName;
return createFormatterFromClassName(className, out);
@@ -53,7 +61,7 @@ private Formatter createFormatterFromClassName(String className, Object out) {
private Class<Formatter> getFormatterClass(String className) {
try {
- return (Class<Formatter>) Class.forName(className);
+ return (Class<Formatter>) classLoader.loadClass(className);
} catch (ClassNotFoundException e) {
throw new CucumberException("Formatter class not found: " + className, e);
}
10 core/src/main/java/cucumber/formatter/HTMLFormatter.java
View
@@ -1,8 +1,8 @@
package cucumber.formatter;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
import cucumber.runtime.CucumberException;
+import gherkin.deps.com.google.gson.Gson;
+import gherkin.deps.com.google.gson.GsonBuilder;
import gherkin.formatter.Formatter;
import gherkin.formatter.Mappable;
import gherkin.formatter.NiceAppendable;
@@ -104,10 +104,14 @@ public void syntaxError(String state, String event, List<String> legalEvents, St
@Override
public void done() {
jsOut().append("});");
- jsOut().close();
copyReportFiles();
}
+ @Override
+ public void close() {
+ jsOut().close();
+ }
+
private void writeToJsReport(String functionName, Mappable statement) {
String json = gson.toJson(statement.toMap());
writeToJsReport(functionName, json);
7 core/src/main/java/cucumber/formatter/MultiFormatter.java
View
@@ -9,6 +9,9 @@
import java.util.ArrayList;
import java.util.List;
+/**
+ * Utility for creating a formatter that delegates to multiple underlying formatters.
+ */
public class MultiFormatter {
private final List<Formatter> formatters = new ArrayList<Formatter>();
private final ClassLoader classLoader;
@@ -21,10 +24,6 @@ public void add(Formatter formatter) {
formatters.add(formatter);
}
- public boolean isEmpty() {
- return formatters.isEmpty();
- }
-
public Formatter formatterProxy() {
return (Formatter) Proxy.newProxyInstance(classLoader, new Class<?>[]{Formatter.class}, new InvocationHandler() {
@Override
4 core/src/main/java/cucumber/formatter/NullReporter.java
View
@@ -55,6 +55,10 @@ public void done() {
}
@Override
+ public void close() {
+ }
+
+ @Override
public void result(Result result) {
}
5 core/src/main/java/cucumber/formatter/ProgressFormatter.java
View
@@ -83,6 +83,11 @@ public void done() {
}
@Override
+ public void close() {
+ out.close();
+ }
+
+ @Override
public void result(Result result) {
if (!monochrome) {
ANSI_ESCAPES.get(result.getStatus()).appendTo(out);
4 core/src/main/java/cucumber/runtime/FeatureBuilder.java
View
@@ -75,6 +75,10 @@ public void syntaxError(String state, String event, List<String> legalEvents, St
public void done() {
}
+ @Override
+ public void close() {
+ }
+
public void parse(Resource resource, List<Object> filters) {
Formatter formatter = this;
if (!filters.isEmpty()) {
2  core/src/main/java/cucumber/runtime/Runtime.java
View
@@ -98,7 +98,7 @@ public void run(CucumberFeature cucumberFeature, Formatter formatter, Reporter r
formatter.feature(cucumberFeature.getFeature());
for (CucumberTagStatement cucumberTagStatement : cucumberFeature.getFeatureElements()) {
//Run the scenario, it should handle before and after hooks
- cucumberTagStatement.run(formatter, reporter, this, cucumberTagStatement);
+ cucumberTagStatement.run(formatter, reporter, this);
}
formatter.eof();
}
4 core/src/main/java/cucumber/runtime/RuntimeGlue.java
View
@@ -1,12 +1,12 @@
package cucumber.runtime;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
import cucumber.io.FileResourceLoader;
import cucumber.runtime.autocomplete.MetaStepdef;
import cucumber.runtime.autocomplete.StepdefGenerator;
import cucumber.runtime.converters.LocalizedXStreams;
import cucumber.runtime.model.CucumberFeature;
+import gherkin.deps.com.google.gson.Gson;
+import gherkin.deps.com.google.gson.GsonBuilder;
import gherkin.formatter.Argument;
import gherkin.formatter.model.Step;
4 core/src/main/java/cucumber/runtime/model/CucumberScenario.java
View
@@ -23,13 +23,13 @@ public CucumberScenario(CucumberFeature cucumberFeature, CucumberBackground cucu
* This method is called when Cucumber is run from the CLI, but not when run from JUnit
*/
@Override
- public void run(Formatter formatter, Reporter reporter, Runtime runtime, StepRunner stepRunner) {
+ public void run(Formatter formatter, Reporter reporter, Runtime runtime) {
runtime.buildBackendWorlds();
runtime.runBeforeHooks(reporter, tags());
runBackground(formatter, reporter, runtime);
format(formatter);
- stepRunner.runSteps(reporter, runtime);
+ runSteps(reporter, runtime);
runtime.runAfterHooks(reporter, tags());
runtime.disposeBackendWorlds();
4 core/src/main/java/cucumber/runtime/model/CucumberScenarioOutline.java
View
@@ -36,13 +36,13 @@ public void examples(Examples examples) {
}
@Override
- public void run(Formatter formatter, Reporter reporter, Runtime runtime, StepRunner stepRunner) {
+ public void run(Formatter formatter, Reporter reporter, Runtime runtime) {
format(formatter);
for (CucumberExamples cucumberExamples : cucumberExamplesList) {
cucumberExamples.format(formatter);
List<CucumberScenario> exampleScenarios = cucumberExamples.createExampleScenarios();
for (CucumberScenario exampleScenario : exampleScenarios) {
- exampleScenario.run(formatter, reporter, runtime, stepRunner);
+ exampleScenario.run(formatter, reporter, runtime);
}
}
}
2  core/src/main/java/cucumber/runtime/model/CucumberTagStatement.java
View
@@ -44,5 +44,5 @@ public String getVisualName() {
}
- public abstract void run(Formatter formatter, Reporter reporter, Runtime runtime, StepRunner stepRunner);
+ public abstract void run(Formatter formatter, Reporter reporter, Runtime runtime);
}
3  core/src/main/java/cucumber/runtime/model/StepContainer.java
View
@@ -9,7 +9,7 @@
import java.util.ArrayList;
import java.util.List;
-public class StepContainer implements StepRunner {
+public class StepContainer {
private final List<Step> steps = new ArrayList<Step>();
private final BasicStatement statement;
protected final CucumberFeature cucumberFeature;
@@ -34,7 +34,6 @@ protected void format(Formatter formatter) {
}
}
- @Override
public void runSteps(Reporter reporter, Runtime runtime) {
for (Step step : getSteps()) {
runStep(step, reporter, runtime);
8 core/src/main/java/cucumber/runtime/model/StepRunner.java
View
@@ -1,8 +0,0 @@
-package cucumber.runtime.model;
-
-import cucumber.runtime.Runtime;
-import gherkin.formatter.Reporter;
-
-public interface StepRunner {
- void runSteps(Reporter reporter, Runtime runtime);
-}
8 core/src/test/java/cucumber/formatter/FormatterFactoryTest.java
View
@@ -2,6 +2,7 @@
import gherkin.formatter.Formatter;
import gherkin.formatter.JSONFormatter;
+import gherkin.formatter.JSONPrettyFormatter;
import gherkin.formatter.PrettyFormatter;
import org.junit.Test;
@@ -14,7 +15,7 @@
public class FormatterFactoryTest {
- private final FormatterFactory formatterFactory = new FormatterFactory();
+ private final FormatterFactory formatterFactory = new FormatterFactory(Thread.currentThread().getContextClassLoader());
@Test
public void shouldInstantiateJsonFormatter() {
@@ -22,6 +23,11 @@ public void shouldInstantiateJsonFormatter() {
}
@Test
+ public void shouldInstantiateJsonPrettyFormatter() {
+ assertThat(formatterFactory.createFormatter("json-pretty", System.out), is(JSONPrettyFormatter.class));
+ }
+
+ @Test
public void shouldInstantiatePrettyFormatter() {
assertThat(formatterFactory.createFormatter("pretty", System.out), is(PrettyFormatter.class));
}
1  core/src/test/java/cucumber/formatter/HTMLFormatterTest.java
View
@@ -32,6 +32,7 @@ public void writes_proper_html() throws IOException {
Runtime runtime = new Runtime(resourceLoader, gluePaths, classLoader, asList(mock(Backend.class)), false);
runtime.run(features.get(0), f, f);
f.done();
+ f.close();
// Let's verify that the JS we wrote parses nicely
5 core/src/test/java/cucumber/formatter/TestFormatter.java
View
@@ -74,4 +74,9 @@ public void syntaxError(String state, String event, List<String> legalEvents, St
public void done() {
throw new UnsupportedOperationException();
}
+
+ @Override
+ public void close() {
+ throw new UnsupportedOperationException();
+ }
}
2  core/src/test/java/cucumber/runtime/HookTest.java
View
@@ -50,7 +50,7 @@ public void after_hooks_execute_before_objects_are_disposed() throws Throwable {
Runtime runtime = new Runtime(new ClasspathResourceLoader(classLoader), CODE_PATHS, classLoader, asList(backend), false);
runtime.getGlue().addAfterHook(hook);
- scenario.run(mock(Formatter.class), mock(Reporter.class), runtime, scenario);
+ scenario.run(mock(Formatter.class), mock(Reporter.class), runtime);
InOrder inOrder = inOrder(hook, backend);
inOrder.verify(hook).execute(Matchers.<ScenarioResult>any());
55 core/src/test/java/cucumber/runtime/RuntimeTest.java
View
@@ -2,7 +2,7 @@
import cucumber.io.ClasspathResourceLoader;
import cucumber.runtime.model.CucumberFeature;
-import gherkin.formatter.JSONFormatter;
+import gherkin.formatter.JSONPrettyFormatter;
import org.junit.Test;
import java.util.Collections;
@@ -23,12 +23,61 @@ public void runs_feature_with_json_formatter() throws Exception {
" Scenario: scenario name\n" +
" When s\n");
StringBuilder out = new StringBuilder();
- JSONFormatter jsonFormatter = new JSONFormatter(out);
+ JSONPrettyFormatter jsonFormatter = new JSONPrettyFormatter(out);
List<Backend> backends = asList(mock(Backend.class));
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
new Runtime(new ClasspathResourceLoader(classLoader), Collections.<String>emptyList(), classLoader, backends, true).run(feature, jsonFormatter, jsonFormatter);
jsonFormatter.done();
- String expected = "[{\"id\":\"feature-name\",\"description\":\"\",\"name\":\"feature name\",\"keyword\":\"Feature\",\"line\":1,\"elements\":[{\"description\":\"\",\"name\":\"background name\",\"keyword\":\"Background\",\"line\":2,\"steps\":[{\"result\":{\"status\":\"undefined\"},\"name\":\"b\",\"keyword\":\"Given \",\"line\":3,\"match\":{}}],\"type\":\"background\"},{\"id\":\"feature-name;scenario-name\",\"description\":\"\",\"name\":\"scenario name\",\"keyword\":\"Scenario\",\"line\":4,\"steps\":[{\"result\":{\"status\":\"undefined\"},\"name\":\"s\",\"keyword\":\"When \",\"line\":5,\"match\":{}}],\"type\":\"scenario\"}],\"uri\":\"test.feature\"}]";
+ String expected = "" +
+ "[\n" +
+ " {\n" +
+ " \"id\": \"feature-name\",\n" +
+ " \"description\": \"\",\n" +
+ " \"name\": \"feature name\",\n" +
+ " \"keyword\": \"Feature\",\n" +
+ " \"line\": 1,\n" +
+ " \"elements\": [\n" +
+ " {\n" +
+ " \"description\": \"\",\n" +
+ " \"name\": \"background name\",\n" +
+ " \"keyword\": \"Background\",\n" +
+ " \"line\": 2,\n" +
+ " \"steps\": [\n" +
+ " {\n" +
+ " \"result\": {\n" +
+ " \"status\": \"undefined\"\n" +
+ " },\n" +
+ " \"name\": \"b\",\n" +
+ " \"keyword\": \"Given \",\n" +
+ " \"line\": 3,\n" +
+ " \"match\": {}\n" +
+ " }\n" +
+ " ],\n" +
+ " \"type\": \"background\"\n" +
+ " },\n" +
+ " {\n" +
+ " \"id\": \"feature-name;scenario-name\",\n" +
+ " \"description\": \"\",\n" +
+ " \"name\": \"scenario name\",\n" +
+ " \"keyword\": \"Scenario\",\n" +
+ " \"line\": 4,\n" +
+ " \"steps\": [\n" +
+ " {\n" +
+ " \"result\": {\n" +
+ " \"status\": \"undefined\"\n" +
+ " },\n" +
+ " \"name\": \"s\",\n" +
+ " \"keyword\": \"When \",\n" +
+ " \"line\": 5,\n" +
+ " \"match\": {}\n" +
+ " }\n" +
+ " ],\n" +
+ " \"type\": \"scenario\"\n" +
+ " }\n" +
+ " ],\n" +
+ " \"uri\": \"test.feature\"\n" +
+ " }\n" +
+ "]";
assertEquals(expected, out.toString());
}
}
4 core/src/test/java/cucumber/runtime/autocomplete/StepdefGeneratorTest.java
View
@@ -1,13 +1,13 @@
package cucumber.runtime.autocomplete;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
import cucumber.io.Resource;
import cucumber.runtime.FeatureBuilder;
import cucumber.runtime.JdkPatternArgumentMatcher;
import cucumber.runtime.ParameterType;
import cucumber.runtime.StepDefinition;
import cucumber.runtime.model.CucumberFeature;
+import gherkin.deps.com.google.gson.Gson;
+import gherkin.deps.com.google.gson.GsonBuilder;
import gherkin.formatter.Argument;
import gherkin.formatter.model.Step;
import org.junit.Test;
2  groovy/pom.xml
View
@@ -5,7 +5,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC12</version>
+ <version>1.0.0.RC13</version>
</parent>
<artifactId>cucumber-groovy</artifactId>
2  guice/pom.xml
View
@@ -5,7 +5,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC12</version>
+ <version>1.0.0.RC13</version>
</parent>
<artifactId>cucumber-guice</artifactId>
2  ioke/pom.xml
View
@@ -5,7 +5,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC12</version>
+ <version>1.0.0.RC13</version>
</parent>
<artifactId>cucumber-ioke</artifactId>
2  java/pom.xml
View
@@ -5,7 +5,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC12</version>
+ <version>1.0.0.RC13</version>
</parent>
<artifactId>cucumber-java</artifactId>
2  java/src/test/java/cucumber/runtime/java/JavaBackendTest.java
View
@@ -7,8 +7,6 @@
import cucumber.runtime.StepDefinitionMatch;
import cucumber.runtime.java.test.Stepdefs;
import gherkin.formatter.model.Step;
-import gherkin.formatter.model.DataTableRow;
-import gherkin.formatter.model.DocString;
import org.junit.Test;
import java.io.File;
2  jruby/pom.xml
View
@@ -5,7 +5,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC12</version>
+ <version>1.0.0.RC13</version>
</parent>
<artifactId>cucumber-jruby</artifactId>
11 jruby/src/test/resources/cucumber/runtime/jruby/test/cukes.feature
View
@@ -36,4 +36,13 @@ Feature: Cukes
When I call that data table from this step:
| field | value |
| omg | lol |
- Then that data table step got called
+ Then that data table step got called
+
+ Scenario Outline: Do a scenario outline calling things
+ Given I store the value "<value>"
+ When I grab another value "<otherValue>"
+ Then those values are the same
+ Examples:
+ | value | otherValue |
+ | 1 | 1 |
+ | awesome | awesome |
12 jruby/src/test/resources/cucumber/runtime/jruby/test/stepdefs.rb
View
@@ -105,3 +105,15 @@ def build_hashes(raw)
end
output
end
+
+Given /^I store the value "([^"]*)"$/ do |value|
+ @value = value
+end
+
+When /^I grab another value "([^"]*)"$/ do |value|
+ @another_value = value
+end
+
+Then /^those values are the same$/ do
+ assert_equal(@value, @another_value)
+end
2  junit/pom.xml
View
@@ -5,7 +5,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC12</version>
+ <version>1.0.0.RC13</version>
</parent>
<artifactId>cucumber-junit</artifactId>
1  junit/src/main/java/cucumber/junit/Cucumber.java
View
@@ -80,6 +80,7 @@ public void run(RunNotifier notifier) {
super.run(notifier);
jUnitReporter.done();
new SummaryPrinter(System.out).print(runtime);
+ jUnitReporter.close();
}
private void assertNoDeclaredMethods(Class clazz) {
15 junit/src/main/java/cucumber/junit/ExecutionUnitRunner.java
View
@@ -2,8 +2,6 @@
import cucumber.runtime.Runtime;
import cucumber.runtime.model.CucumberScenario;
-import cucumber.runtime.model.StepRunner;
-import gherkin.formatter.Reporter;
import gherkin.formatter.model.Step;
import org.junit.runner.Description;
import org.junit.runner.notification.RunNotifier;
@@ -45,17 +43,16 @@ protected Description describeChild(Step step) {
@Override
public void run(final RunNotifier notifier) {
jUnitReporter.startExecutionUnit(this, notifier);
- cucumberScenario.run(jUnitReporter, jUnitReporter, runtime, new StepRunner() {
- @Override
- public void runSteps(Reporter reporter, Runtime runtime) {
- ExecutionUnitRunner.super.run(notifier);
- }
- });
+ // This causes runChild to never be called, which seems OK.
+ cucumberScenario.run(jUnitReporter, jUnitReporter, runtime);
jUnitReporter.finishExecutionUnit();
}
@Override
protected void runChild(Step step, RunNotifier notifier) {
- cucumberScenario.runStep(step, jUnitReporter, runtime);
+ // The way we override run(RunNotifier) causes this method to never be called.
+ // Instead it happens via cucumberScenario.run(jUnitReporter, jUnitReporter, runtime);
+ throw new UnsupportedOperationException();
+ // cucumberScenario.runStep(step, jUnitReporter, runtime);
}
}
15 junit/src/main/java/cucumber/junit/JUnitReporter.java
View
@@ -74,6 +74,12 @@ public void result(Result result) {
}
}
}
+ if(steps.isEmpty()) {
+ // We have run all of our steps. Set the stepNotifier to null so that
+ // if an error occurs in an After block, it's reported against the scenario
+ // instead (via executionUnitNotifier).
+ stepNotifier = null;
+ }
reporter.result(result);
}
@@ -128,11 +134,8 @@ public void done() {
formatter.done();
}
- public Formatter getFormatter() {
- return formatter;
- }
-
- public Reporter getReporter() {
- return reporter;
+ @Override
+ public void close() {
+ formatter.close();
}
}
2  jython/pom.xml
View
@@ -5,7 +5,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC12</version>
+ <version>1.0.0.RC13</version>
</parent>
<artifactId>cucumber-jython</artifactId>
2  openejb/pom.xml
View
@@ -5,7 +5,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC11-SNAPSHOT</version>
+ <version>1.0.0.RC13</version>
</parent>
<artifactId>cucumber-openejb</artifactId>
2  ...cucumber/runtime/java/openejb/CDIFactoryTest.java → ...untime/java/openejb/OpenEJBObjectFactoryTest.java
View
@@ -6,7 +6,7 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
-public class CDIFactoryTest {
+public class OpenEJBObjectFactoryTest {
@Test
public void shouldGiveUsNewInstancesForEachScenario() {
ObjectFactory factory = new OpenEJBObjectFactory();
7 openejb/src/test/resources/META-INF/beans.xml
View
@@ -0,0 +1,7 @@
+<beans xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+
+</beans>
2  picocontainer/pom.xml
View
@@ -5,7 +5,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC12</version>
+ <version>1.0.0.RC13</version>
</parent>
<artifactId>cucumber-picocontainer</artifactId>
14 pom.xml
View
@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
- <version>1.0.0.RC12</version>
+ <version>1.0.0.RC13</version>
<packaging>pom</packaging>
<name>Cucumber-JVM</name>
<url>http://cukes.info/</url>
@@ -15,7 +15,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<outputDirectory>${project.build.directory}</outputDirectory>
- <gherkin.version>2.7.4</gherkin.version>
+ <gherkin.version>2.7.6</gherkin.version>
<groovy.version>1.8.5</groovy.version>
</properties>
<licenses>
@@ -169,11 +169,6 @@
<version>1.9.0</version>
</dependency>
<dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <version>2.1</version>
- </dependency>
- <dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>2.15.0</version>
@@ -216,7 +211,7 @@
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>openejb-core</artifactId>
- <version>4.0.0-beta-2-SNAPSHOT</version>
+ <version>4.0.0-beta-2</version>
</dependency>
<dependency>
<groupId>javax.enterprise</groupId>
@@ -267,8 +262,7 @@
<module>rhino</module>
<module>java</module>
<module>clojure</module>
-
- <!--<module>openejb</module>-->
+ <module>openejb</module>
</modules>
<profiles>
2  rhino/pom.xml
View
@@ -5,7 +5,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC12</version>
+ <version>1.0.0.RC13</version>
</parent>
<artifactId>cucumber-rhino</artifactId>
2  scala/pom.xml
View
@@ -5,7 +5,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC12</version>
+ <version>1.0.0.RC13</version>
</parent>
<artifactId>cucumber-scala</artifactId>
2  spring/pom.xml
View
@@ -5,7 +5,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC12</version>
+ <version>1.0.0.RC13</version>
</parent>
<artifactId>cucumber-spring</artifactId>
2  weld/pom.xml
View
@@ -5,7 +5,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC12</version>
+ <version>1.0.0.RC13</version>
</parent>
<artifactId>cucumber-weld</artifactId>
2  ...n/java/cucumber/runtime/java/weld/CDIFactory.java → .../java/cucumber/runtime/java/weld/WeldFactory.java
View
@@ -4,7 +4,7 @@
import org.jboss.weld.environment.se.Weld;
import org.jboss.weld.environment.se.WeldContainer;
-public class CDIFactory extends Weld implements ObjectFactory {
+public class WeldFactory extends Weld implements ObjectFactory {
private WeldContainer weld;
4 ...va/cucumber/runtime/java/weld/CDIFactoryTest.java → ...a/cucumber/runtime/java/weld/WeldFactoryTest.java
View
@@ -6,10 +6,10 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
-public class CDIFactoryTest {
+public class WeldFactoryTest {
@Test
public void shouldGiveUsNewInstancesForEachScenario() {
- ObjectFactory factory = new CDIFactory();
+ ObjectFactory factory = new WeldFactory();
factory.addClass(BellyStepdefs.class);
// Scenario 1

No commit comments for this range

Something went wrong with that request. Please try again.