13
13
import cucumber .runtime .RuntimeOptions ;
14
14
import cucumber .runtime .PickleStepDefinitionMatch ;
15
15
import cucumber .runtime .UndefinedPickleStepDefinitionMatch ;
16
- import cucumber .runtime .UnreportedStepExecutor ;
17
16
import gherkin .events .PickleEvent ;
18
- import gherkin .pickles .Argument ;
19
- import gherkin .pickles .PickleLocation ;
20
- import gherkin .pickles .PickleRow ;
21
17
import gherkin .pickles .PickleStep ;
22
- import gherkin .pickles .PickleString ;
23
- import gherkin .pickles .PickleTable ;
24
18
import gherkin .pickles .PickleTag ;
25
19
26
20
import java .util .ArrayList ;
27
21
import java .util .Collection ;
28
- import java .util .Collections ;
29
22
import java .util .List ;
30
23
31
- public class Runner implements UnreportedStepExecutor {
24
+ public class Runner {
32
25
private final Glue glue ;
33
26
private final EventBus bus ;
34
27
private final Collection <? extends Backend > backends ;
@@ -41,37 +34,10 @@ public Runner(Glue glue, EventBus bus, Collection<? extends Backend> backends, R
41
34
this .backends = backends ;
42
35
for (Backend backend : backends ) {
43
36
backend .loadGlue (glue , runtimeOptions .getGlue ());
44
- backend .setUnreportedStepExecutor (this );
45
37
}
46
38
47
39
}
48
40
49
- //TODO: Maybe this should go into the cucumber step execution model and it should return the result of that execution!
50
- @ Override
51
- public void runUnreportedStep (String featurePath , String language , String stepName , int line , List <PickleRow > dataTableRows , PickleString docString ) throws Throwable {
52
- List <Argument > arguments = new ArrayList <Argument >();
53
- if (dataTableRows != null && !dataTableRows .isEmpty ()) {
54
- arguments .add (new PickleTable (dataTableRows ));
55
- } else if (docString != null ) {
56
- arguments .add (docString );
57
- }
58
- PickleStep step = new PickleStep (stepName , arguments , Collections .<PickleLocation >emptyList ());
59
-
60
- PickleStepDefinitionMatch match = glue .stepDefinitionMatch (featurePath , step );
61
- if (match == null ) {
62
- UndefinedStepException error = new UndefinedStepException (step );
63
-
64
- StackTraceElement [] originalTrace = error .getStackTrace ();
65
- StackTraceElement [] newTrace = new StackTraceElement [originalTrace .length + 1 ];
66
- newTrace [0 ] = new StackTraceElement ("✽" , "StepDefinition" , featurePath , line );
67
- System .arraycopy (originalTrace , 0 , newTrace , 1 , originalTrace .length );
68
- error .setStackTrace (newTrace );
69
-
70
- throw error ;
71
- }
72
- match .runStep (language , null );
73
- }
74
-
75
41
public void runPickle (PickleEvent pickle ) {
76
42
buildBackendWorlds (); // Java8 step definitions will be added to the glue here
77
43
TestCase testCase = createTestCaseForPickle (pickle );
0 commit comments