Details
Description
Scenarios parameterised by examples are skipped if scenario level meta filtering is used. This seems to be a direct result of changes introduced by JBEHAVE-846.
eg:
<metaFilters> <metaFilter>+foo *</metaFilter> </metaFilters>
Meta: @foo bar Scenario: Given I am a 'Partner' user When a 'Business Support' case is created with: |name |value | |Code |<Code> | |Process |<Process> | |Sub Process |<Sub Process> | Then the case has 1 item in basket 'Partner Team' Examples: |<Code> |<Process> |<Sub Process> | |XYZ |Business Support |Bank Statement Upload |
Execution of the above results in the before and after steps being executed but all scenario steps being skipped.
Debugging the code shows that the check:
if ( !context.filter.allow(parameterMeta) ){ continue; }
in the method:
StoryRunner.java
private void runScenariosParametrisedByExamples(RunContext context, Scenario scenario, Meta storyAndScenarioMeta) throws Throwable { ExamplesTable table = scenario.getExamplesTable(); reporter.get().beforeExamples(scenario.getSteps(), table); Keywords keywords = context.configuration().keywords(); for (Map<String, String> scenarioParameters : table.getRows()) { Meta parameterMeta = parameterMeta(keywords, scenarioParameters); if ( !context.filter.allow(parameterMeta) ){ continue; } reporter.get().example(scenarioParameters); if (context.configuration().storyControls().resetStateBeforeScenario()) { context.resetState(); } runBeforeOrAfterScenarioSteps(context, scenario, storyAndScenarioMeta, Stage.BEFORE, ScenarioType.EXAMPLE); addMetaParameters(scenarioParameters, storyAndScenarioMeta); runGivenStories(scenario.getGivenStories(), scenarioParameters, context); runScenarioSteps(context, scenario, scenarioParameters); runBeforeOrAfterScenarioSteps(context, scenario, storyAndScenarioMeta, Stage.AFTER, ScenarioType.EXAMPLE); } reporter.get().afterExamples(); }
always passes resulting in 'continue' and the scenario execution being skipped.
Using the example above, context.filter='+foo *', but because the meta parameter 'foo' is at scenario level and not at examples table level, parameterMeta is empty and the filter.allow() is false resulting in 'continue'.
Activity
Mauro Talevi
made changes -
Field | Original Value | New Value |
---|---|---|
Fix Version/s | 3.7.5 [ 18997 ] |
Mauro Talevi
made changes -
Assignee | Mauro Talevi [ maurotalevi ] |
Mauro Talevi
made changes -
Status | Open [ 1 ] | Resolved [ 5 ] |
Resolution | Fixed [ 1 ] |
Mauro Talevi
made changes -
Fix Version/s | 3.8 [ 19104 ] |
Just to be clear, this has also broken the ability to be able to filter at the story level. This is a pretty big deal for all of us using meta filtering and is preventing us from upgrading.