Skip to content

Commit 54005e9

Browse files
committed
feat: update scenarios and steps for improved clarity and consistency
1 parent d0797f3 commit 54005e9

File tree

4 files changed

+13
-30
lines changed

4 files changed

+13
-30
lines changed

cucumber_cpp/acceptance_test/features/test_scenarios.feature

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,5 @@ Feature: Simple feature file
1818

1919
@result:UNDEFINED
2020
Scenario: A scenario with undefined step
21-
Given a given step
22-
When a when step
23-
Then a missing step
24-
Then a then step
21+
Given a missing step
22+
Then this should be skipped

cucumber_cpp/acceptance_test/steps/Steps.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,8 @@ GIVEN("a ← tuple\\({float}, {float}, {float}, {float}\\)", (float /* unused */
5050
{
5151
// empty
5252
}
53+
54+
THEN("this should be skipped")
55+
{
56+
FAIL();
57+
}

cucumber_cpp/acceptance_test/test.bats

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ teardown() {
3030
run .build/Host/cucumber_cpp/acceptance_test/Debug/cucumber_cpp.acceptance_test run --tag "@result:UNDEFINED" --feature cucumber_cpp/acceptance_test/features --report console
3131
assert_failure
3232
assert_output --partial "undefined \"cucumber_cpp/acceptance_test/features/test_scenarios.feature\""
33-
assert_output --partial "skipped Then a then step"
33+
assert_output --partial "skipped Then this should be skipped"
3434
}
3535

3636
@test "No tests" {
@@ -127,7 +127,7 @@ teardown() {
127127
run .build/Host/cucumber_cpp/acceptance_test/Debug/cucumber_cpp.acceptance_test run --feature cucumber_cpp/acceptance_test/features --tag "@result:UNDEFINED" --report console --dry
128128
assert_failure
129129
assert_output --partial "undefined \"cucumber_cpp/acceptance_test/features/test_scenarios.feature\""
130-
assert_output --partial "skipped Then a then step"
130+
assert_output --partial "skipped Then this should be skipped"
131131
}
132132

133133
@test "Test the and keyword" {

cucumber_cpp/library/test/TestSteps.cpp

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,10 @@ namespace cucumber_cpp::library
2525

2626
TEST_F(TestSteps, GetGivenStep)
2727
{
28-
const auto matches = stepRegistry.Query("This is a GIVEN step");
29-
30-
EXPECT_THAT(matches.stepRegexStr, testing::StrEq("^This is a GIVEN step$"));
31-
}
32-
33-
TEST_F(TestSteps, GetWhenStep)
34-
{
35-
const auto matches = stepRegistry.Query("This is a WHEN step");
36-
37-
EXPECT_THAT(matches.stepRegexStr, testing::StrEq("^This is a WHEN step$"));
38-
}
39-
40-
TEST_F(TestSteps, GetThenStep)
41-
{
42-
const auto matches = stepRegistry.Query("This is a THEN step");
43-
44-
EXPECT_THAT(matches.stepRegexStr, testing::StrEq("^This is a THEN step$"));
45-
}
46-
47-
TEST_F(TestSteps, GetAnyStep)
48-
{
49-
const auto matches = stepRegistry.Query("This is a STEP step");
50-
51-
EXPECT_THAT(matches.stepRegexStr, testing::StrEq("^This is a STEP step$"));
28+
EXPECT_THAT(stepRegistry.Query("This is a GIVEN step").stepRegexStr, testing::StrEq("^This is a GIVEN step$"));
29+
EXPECT_THAT(stepRegistry.Query("This is a WHEN step").stepRegexStr, testing::StrEq("^This is a WHEN step$"));
30+
EXPECT_THAT(stepRegistry.Query("This is a THEN step").stepRegexStr, testing::StrEq("^This is a THEN step$"));
31+
EXPECT_THAT(stepRegistry.Query("This is a STEP step").stepRegexStr, testing::StrEq("^This is a STEP step$"));
5232
}
5333

5434
TEST_F(TestSteps, GetStepWithMatches)

0 commit comments

Comments
 (0)