Skip to content

Conversation

@acoulton
Copy link
Contributor

@acoulton acoulton commented May 7, 2025

Behat/Gherkin@4.13.0 introduced a number of new translations. Although these are BC for end-users, the new translation options appear in our --story-syntax output so the expectation for this needs to be updated.

@acoulton
Copy link
Contributor Author

acoulton commented May 7, 2025

Urgh, of course the output of the --story-syntax in Russian now varies between the lowest (v4.12.0) and latest (v4.13.0) Behat/Gherkin versions, so there's no way to have the current feature file pass on all builds in the matrix :-(

I'm not sure of the best solution for this, particularly because of course now that we're updating gherkin regularly it could easily recur in future (and perhaps on a gherkin release that also contains more significant changes).

  • We could bump our minimum behat/gherkin to 4.13.0, but it feels wrong to force users to upgrade just to pass one of our tests
  • We could introduce a behat profile with tags to allow us to skip specific scenarios on the composer --lowest build
  • We could remove the first two lines (# language: ru and the breaking Feature: line) in the output should contain step, which would solve it for now but give the same problem if Scenario / Given / etc were to change in future, and means the feature is less clear about what we actually expect to see.
  • We could somehow have that feature do a loose match on the output with some kind of wildcard syntax that maps back to the expected translations.

I think the wildcard approach is the least likely to unexpectedly break in future, with a feature like:

Then the output should contain the following with russian translations:
      """
      # language: ru
      [%GHERKIN_FEATURES_KEYWORDS%]: Internal operations
        In order to stay secret
        As a secret organization
        We need to be able to erase past agents' memory

        [%GHERKIN_SCENARIO_KEYWORDS%]:
          [%GHERKIN_GIVEN_KEYWORDS%] there is agent A
      ... etc ...
      """

However, this means we'd be asking gherkin at runtime for both the implementation and the expected test result. Which means the feature provides less confidence about the actual output than it does now...

@carlos-granados what do you think - any better ideas?

@carlos-granados
Copy link
Contributor

@acoulton Mmm, it is a difficult problem.

Of the solutions that you mentioned I feel that "We could introduce a behat profile with tags to allow us to skip specific scenarios on the composer --lowest build" is the one that sounded better as it would allow us to confirm the behaviour with both versions. Can you maybe check about the feasibility of this option?

@acoulton
Copy link
Contributor Author

acoulton commented May 7, 2025

Yeah I think that might be best, but (because we don't pin the upper gherkin version) would still mean the "not-lowest" build will start failing on all branches if/when a future Gherkin release adds more russian translations until we update the features and merge/rebase them into all Behat branches.

Given that, I'm wondering this evening if we should just swap that example from Russian to a language we know is the same in all current Gherkin versions, and hope that it doesn't change in future...

One of the latin-based languages that's been in gherkin for a long time would probably be fairly stable, ideally one with at least a couple of utf8 diacritics to prove the character set works as expected...

That would definitely be the quickest solution, WDYT?

@carlos-granados
Copy link
Contributor

Ah, yes, that would work too, let's go with that

@acoulton acoulton force-pushed the maint-test-gherkin-lang branch from f5e9c20 to 2c26385 Compare May 8, 2025 08:24
Behat/Gherkin@4.13.0 introduced a number of new translations. These are
BC for end-users (when parsing the features, any of the past-or-present
translations will be recognised).

However, our `--story-syntax` command outputs all known translations
when displaying the example feature. This means the expected output in
our tests has to exactly match the Behat/Gherkin translations across all
supported versions. This caused CI to break due to extra Russian
translations between 4.12 and 4.13.

I have switched the test to Greek because it appears to be stable (has
not changed in cucumber/gherkin in the last 8 years), still contains
UTF-8 to prove character sets work as expected, and has a variety of
keywords with/without synonyms.
@acoulton acoulton force-pushed the maint-test-gherkin-lang branch from 2c26385 to 4fc1d69 Compare May 8, 2025 09:34
@acoulton acoulton requested a review from carlos-granados May 8, 2025 09:34
@acoulton
Copy link
Contributor Author

acoulton commented May 8, 2025

@carlos-granados I went for Greek as it has extended characters and according to the git blame on the translations in upstream cucumber/gherkin it has not changed in the last 8 years so hopefully will be fairly stable.

Copy link
Contributor

@carlos-granados carlos-granados left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, I hope that the Greek is ok and we don't get any Greek users saying "what the heck is that?" 🤣

@acoulton
Copy link
Contributor Author

acoulton commented May 8, 2025

I hope not - if so at least we can direct them to cucumber/gherkin so it won't be our fault 😆

@acoulton acoulton merged commit 42852bf into Behat:master May 8, 2025
18 checks passed
@acoulton acoulton deleted the maint-test-gherkin-lang branch May 8, 2025 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants