Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Fixed
- [Core] Emit StepMatchArgumentsList for ambiguous steps ([#3066](https://github.com/cucumber/cucumber-jvm/pull/3066) M.P. Korstanje)

### Changed
- [Core] Update dependency io.cucumber:cucumber-json-formatter to v0.2.0
- [Core] Update dependency io.cucumber:gherkin to v35.0.0
- [Core] Update dependency io.cucumber:html-formatter to v21.15.0
- [Core] Update dependency io.cucumber:junit-xml-formatter to v0.9.0
- [Core] Update dependency io.cucumber:messages to v29.0.1
- [Core] Update dependency io.cucumber:pretty-formatter to v2.2.0
- [Core] Update dependency io.cucumber:query to v14.0.1
- [Core] Update dependency io.cucumber:testng-xml-formatter to v0.6.0

## [7.28.2] - 2025-09-09
### Fixed
Expand Down
14 changes: 7 additions & 7 deletions cucumber-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
<properties>
<ci-environment.version>10.0.1</ci-environment.version>
<cucumber-expressions.version>18.0.1</cucumber-expressions.version>
<cucumber-json-formatter.version>0.1.3</cucumber-json-formatter.version>
<gherkin.version>34.0.0</gherkin.version>
<html-formatter.version>21.13.0</html-formatter.version>
<junit-xml-formatter.version>0.8.1</junit-xml-formatter.version>
<cucumber-json-formatter.version>0.2.0</cucumber-json-formatter.version>
<gherkin.version>35.0.0</gherkin.version>
<html-formatter.version>21.15.1</html-formatter.version>
<junit-xml-formatter.version>0.9.0</junit-xml-formatter.version>
<messages.version>29.0.1</messages.version>
<pretty-formatter.version>2.1.0</pretty-formatter.version>
<query.version>13.6.0</query.version>
<pretty-formatter.version>2.2.0</pretty-formatter.version>
<query.version>14.0.1</query.version>
<tag-expressions.version>6.1.2</tag-expressions.version>
<testng-xml-formatter.version>0.5.0</testng-xml-formatter.version>
<testng-xml-formatter.version>0.6.0</testng-xml-formatter.version>
</properties>

<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

import io.cucumber.core.backend.TestCaseState;
import io.cucumber.core.gherkin.Step;
import io.cucumber.plugin.event.Argument;

import java.net.URI;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

final class AmbiguousPickleStepDefinitionsMatch extends PickleStepDefinitionMatch {

Expand All @@ -25,4 +28,10 @@ public void dryRunStep(TestCaseState state) throws AmbiguousStepDefinitionsExcep
throw exception;
}

List<List<Argument>> getDefinitionArguments() {
return exception.getMatches().stream()
.map(Match::getArguments)
.map(DefinitionArgument::createArguments)
.collect(Collectors.toList());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ private PickleStepDefinitionMatch findStepDefinitionMatch(URI uri, Step step)
return null;
}
if (matches.size() > 1) {
// TODO: Don't use exceptions for control flow
throw new AmbiguousStepDefinitionsException(step, matches);
}

Expand Down
20 changes: 16 additions & 4 deletions cucumber-core/src/main/java/io/cucumber/core/runner/TestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import io.cucumber.messages.types.Envelope;
import io.cucumber.messages.types.StepMatchArgument;
import io.cucumber.messages.types.StepMatchArgumentsList;
import io.cucumber.plugin.event.Argument;
import io.cucumber.plugin.event.Group;
import io.cucumber.plugin.event.Location;
import io.cucumber.plugin.event.Result;
Expand Down Expand Up @@ -199,14 +200,25 @@ private io.cucumber.messages.types.TestStep createTestStep(TestStep pluginTestSt
}

public List<StepMatchArgumentsList> getStepMatchArguments(PickleStepTestStep pickleStep) {
if (pickleStep.getDefinitionMatch() instanceof UndefinedPickleStepDefinitionMatch) {
PickleStepDefinitionMatch definitionMatch = pickleStep.getDefinitionMatch();
if (definitionMatch instanceof UndefinedPickleStepDefinitionMatch) {
return emptyList();
}

return singletonList(pickleStep.getDefinitionArgument()
.stream()
if (definitionMatch instanceof AmbiguousPickleStepDefinitionsMatch) {
AmbiguousPickleStepDefinitionsMatch ambiguousPickleStepDefinitionsMatch = (AmbiguousPickleStepDefinitionsMatch) definitionMatch;
return ambiguousPickleStepDefinitionsMatch.getDefinitionArguments().stream()
.map(TestCase::createStepMatchArgumentList)
.collect(toList());
}

return singletonList(createStepMatchArgumentList(pickleStep.getDefinitionArgument()));
}

private static StepMatchArgumentsList createStepMatchArgumentList(List<Argument> arguments) {
return arguments.stream()
.map(arg -> new StepMatchArgument(makeMessageGroup(arg.getGroup()), arg.getParameterTypeName()))
.collect(Collectors.collectingAndThen(toList(), StepMatchArgumentsList::new)));
.collect(Collectors.collectingAndThen(toList(), StepMatchArgumentsList::new));
}

private void emitTestCaseStarted(EventBus bus, Instant start, UUID executionId) {
Expand Down
Loading