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: 9 additions & 3 deletions dotnet/Cucumber.QueryTest/QueryAcceptanceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,15 @@ public static IEnumerable<object[]> Acceptance()
.Select(tcf => q.FindTestStepsStartedBy(tcf).Select(tss => tss.TestStepId).ToList())
.ToList()
},
["findTestStepsFinishedBy"] = q => new Dictionary<string, object>
{
["testCaseStarted"] = q.FindAllTestCaseStarted()
.Select(tcs => q.FindTestStepsFinishedBy(tcs).Select(tss => tss.TestStepId).ToList())
.ToList(),
["testCaseFinished"] = q.FindAllTestCaseFinished()
.Select(tcf => q.FindTestStepsFinishedBy(tcf).Select(tss => tss.TestStepId).ToList())
.ToList()
},
["findTestRunHookFinishedBy"] = q => q.FindAllTestRunHookStarted()
.Select(trhs => q.FindTestRunHookFinishedBy(trhs)?.TestRunHookStartedId)
.ToList(),
Expand All @@ -241,9 +250,6 @@ public static IEnumerable<object[]> Acceptance()
.Select(tsf => q.FindTestStepBy(tsf)?.Id)
.ToList()
},
["findTestStepsFinishedBy"] = q => q.FindAllTestCaseStarted()
.Select(tcs => q.FindTestStepsFinishedBy(tcs).Select(tsf => tsf.TestStepId).ToList())
.ToList(),
["findTestStepFinishedAndTestStepBy"] = q => q.FindAllTestCaseStarted()
.SelectMany(tcs => q.FindTestStepFinishedAndTestStepBy(tcs))
.Select(pair => new object?[] { pair.Item1.TestStepId, pair.Item2.Id })
Expand Down
20 changes: 16 additions & 4 deletions java/src/test/java/io/cucumber/query/QueryAcceptanceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,22 @@ static Map<String, Function<Query, Object>> createQueries() {
return results;
});

queries.put("findTestStepsFinishedBy", query -> {
Map<String, Object> results = new LinkedHashMap<>();

results.put("testCaseStarted", query.findAllTestCaseFinished().stream()
.map(query::findTestStepsFinishedBy)
.map(Collection::stream)
.map(testStepStarted -> testStepStarted.map(TestStepFinished::getTestStepId))
.collect(toList()));
results.put("testCaseFinished", query.findAllTestCaseFinished().stream()
.map(query::findTestStepsFinishedBy)
.map(Collection::stream)
.map(testStepStarted -> testStepStarted.map(TestStepFinished::getTestStepId))
.collect(toList()));
return results;
});

queries.put("findTestRunHookFinishedBy", query -> query.findAllTestRunHookStarted().stream()
.map(query::findTestRunHookFinishedBy)
.map(testRunHookFinished -> testRunHookFinished.map(TestRunHookFinished::getTestRunHookStartedId))
Expand Down Expand Up @@ -440,10 +456,6 @@ static Map<String, Function<Query, Object>> createQueries() {
return results;
});

queries.put("findTestStepsFinishedBy", query -> query.findAllTestCaseStarted().stream()
.map(query::findTestStepsFinishedBy)
.map(testStepFinisheds -> testStepFinisheds.stream().map(TestStepFinished::getTestStepId).collect(toList()))
.collect(toList()));
queries.put("findTestStepFinishedAndTestStepBy", query -> query.findAllTestCaseStarted().stream()
.map(query::findTestStepFinishedAndTestStepBy)
.flatMap(Collection::stream)
Expand Down
23 changes: 16 additions & 7 deletions javascript/src/acceptance.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,22 @@ describe('Acceptance Tests', async () => {
),
}
},
findTestStepsFinishedBy: (query: Query) => {
return {
testCaseStarted: query
.findAllTestCaseStarted()
.map((testCaseStarted) => query.findTestStepsFinishedBy(testCaseStarted))
.map((testStepsStarted) =>
testStepsStarted.map((testStepStarted) => testStepStarted.testStepId)
),
testCaseFinished: query
.findAllTestCaseFinished()
.map((testCaseFinished) => query.findTestStepsFinishedBy(testCaseFinished))
.map((testStepsStarted) =>
testStepsStarted.map((testStepStarted) => testStepStarted.testStepId)
),
}
},
findTestStepBy: (query: Query) => {
return {
testStepStarted: query
Expand All @@ -268,13 +284,6 @@ describe('Acceptance Tests', async () => {
.map((testStep) => testStep?.id),
}
},
findTestStepsFinishedBy: (query: Query) =>
query
.findAllTestCaseStarted()
.map((testCaseStarted) => query.findTestStepsFinishedBy(testCaseStarted))
.map((testStepFinisheds) =>
testStepFinisheds.map((testStepFinished) => testStepFinished?.testStepId)
),
findTestStepFinishedAndTestStepBy: (query: Query) =>
query
.findAllTestCaseStarted()
Expand Down
12 changes: 12 additions & 0 deletions ruby/spec/cucumber/query_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,18 @@ def parse_ndjson_file(path)
results['testStepStarted'] = query.find_all_test_step_started.map { |message| query.find_test_step_by(message).id }
results['testStepFinished'] = query.find_all_test_step_finished.map { |message| query.find_test_step_by(message).id }
results
end,
'findTestStepsStartedBy' => lambda do |query|
results = {}
results['testCaseStarted'] = query.find_all_test_case_started.map { |message| query.find_test_steps_started_by(message).map(&:test_step_id) }
results['testCaseFinished'] = query.find_all_test_case_finished.map { |message| query.find_test_steps_started_by(message).map(&:test_step_id) }
results
end,
'findTestStepsFinishedBy' => lambda do |query|
results = {}
results['testCaseStarted'] = query.find_all_test_case_started.map { |message| query.find_test_steps_finished_by(message).map(&:test_step_id) }
results['testCaseFinished'] = query.find_all_test_case_finished.map { |message| query.find_test_steps_finished_by(message).map(&:test_step_id) }
results
end
}

Expand Down
76 changes: 52 additions & 24 deletions testdata/src/attachments.findTestStepsFinishedBy.results.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,54 @@
[
[
"42"
{
"testCaseStarted" : [
[
"42"
],
[
"44"
],
[
"46"
],
[
"48"
],
[
"50"
],
[
"52"
],
[
"54"
],
[
"56"
]
],
[
"44"
],
[
"46"
],
[
"48"
],
[
"50"
],
[
"52"
],
[
"54"
],
[
"56"
"testCaseFinished" : [
[
"42"
],
[
"44"
],
[
"46"
],
[
"48"
],
[
"50"
],
[
"52"
],
[
"54"
],
[
"56"
]
]
]
}
11 changes: 8 additions & 3 deletions testdata/src/empty.findTestStepsFinishedBy.results.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
[
[ ]
]
{
"testCaseStarted" : [
[ ]
],
"testCaseFinished" : [
[ ]
]
}
109 changes: 74 additions & 35 deletions testdata/src/examples-tables.findTestStepsFinishedBy.results.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,76 @@
[
[
"58",
"59",
"60"
{
"testCaseStarted" : [
[
"58",
"59",
"60"
],
[
"62",
"63",
"64"
],
[
"66",
"67",
"68"
],
[
"70",
"71",
"72"
],
[
"74",
"75",
"76"
],
[
"78",
"79",
"80"
],
[
"82",
"83",
"84"
]
],
[
"62",
"63",
"64"
],
[
"66",
"67",
"68"
],
[
"70",
"71",
"72"
],
[
"74",
"75",
"76"
],
[
"78",
"79",
"80"
],
[
"82",
"83",
"84"
"testCaseFinished" : [
[
"58",
"59",
"60"
],
[
"62",
"63",
"64"
],
[
"66",
"67",
"68"
],
[
"70",
"71",
"72"
],
[
"74",
"75",
"76"
],
[
"78",
"79",
"80"
],
[
"82",
"83",
"84"
]
]
]
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
[
[
"10"
{
"testCaseStarted" : [
[
"10"
]
],
"testCaseFinished" : [
[
"10"
]
]
]
}
22 changes: 16 additions & 6 deletions testdata/src/global-hooks.findTestStepsFinishedBy.results.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
[
[
"18"
{
"testCaseStarted" : [
[
"18"
],
[
"20"
]
],
[
"20"
"testCaseFinished" : [
[
"18"
],
[
"20"
]
]
]
}
Loading
Loading