ExecutionNodeRunner implements SubstepsRunner { public RootNode prepareExecutionConfig(final Config config , final Syntax syntax, final TestParameters parameters, final SetupAndTearDown setupAndTearDown , final MethodExecutor methodExecutorToUse, TagManager nonFatalTagmanager ) { final ExecutionNodeTreeBuilder nodeTreeBuilder = new ExecutionNodeTreeBuilder(parameters, config); this.rootNode = nodeTreeBuilder.buildExecutionNodeTree(NewSubstepsExecutionConfig.getDescription(config)); setupExecutionListeners(NewSubstepsExecutionConfig.getExecutionListenerClasses(config)); if (NewSubstepsExecutionConfig.isCheckForUncalledAndUnused(config)) { processUncalledAndUnused(syntax, NewSubstepsExecutionConfig.getDataOutputDirectory(config)); } ExecutionContext.put(Scope.SUITE, INotificationDistributor.NOTIFIER_DISTRIBUTOR_KEY, this.notificationDistributor); this.nodeExecutionContext = new RootNodeExecutionContext(this.notificationDistributor, Lists.<SubstepExecutionFailure>newArrayList(), setupAndTearDown, nonFatalTagmanager, methodExecutorToUse); return this.rootNode; }  @Override void addNotifier(final IExecutionListener notifier); RootNode prepareExecutionConfig(final Config config , final Syntax syntax, final TestParameters parameters,
                                           final SetupAndTearDown setupAndTearDown ,
                                           final MethodExecutor methodExecutorToUse,
                                           TagManager nonFatalTagmanager ); static Class<?>[] buildInitialisationClassList(List<Class<?>> stepImplClassList, List<Class<?>> initialisationClassList); @Override RootNode prepareExecutionConfig(Config cfg); @Override RootNode run(); @Override List<SubstepExecutionFailure> getFailures();  }
@Test public void testExecutionNodeTreeBuildingWithScenarioName() { final String feature = "./target/test-classes/features/allFeatures.feature"; final String scenarioName = "Simple top level scenario"; final String substeps = "./target/test-classes/substeps/simple.substeps"; final IExecutionListener notifier = mock(IExecutionListener.class); final List<SubstepExecutionFailure> failures = new ArrayList<>(); final List<Class<?>> stepImplementationClasses = new ArrayList<>(); stepImplementationClasses.add(MockStepImplementations.class); final SubstepsExecutionConfig executionConfig = new SubstepsExecutionConfig(); Assert.assertTrue(failures.isEmpty()); executionConfig.setScenarioName(scenarioName); executionConfig.setFeatureFile(feature); executionConfig.setSubStepsFileName(substeps); executionConfig.setDescription("ExecutionNodeRunner Test feature set"); executionConfig.setStepImplementationClasses(stepImplementationClasses); executionConfig.setStrict(false); executionConfig.setNonStrictKeywordPrecedence(new String[]{"Given", "And"}); executionConfig.setFastFailParseErrors(false); Config masterConfig = NewSubstepsExecutionConfig.toConfig(executionConfig); Config cfg = SubstepsConfigLoader.splitMasterConfig(masterConfig).get(0); NewSubstepsExecutionConfig.setThreadLocalConfig(cfg); final RootNode rootNode = runner.prepareExecutionConfig(cfg); Assert.assertThat(rootNode.getChildren().size(), is(1)); Assert.assertThat(rootNode.getChildren().get(0).getChildren().size(), is(1)); }