feat(converter): add converter for all tests cucumber#73
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Cucumber test suite to use typed Cucumber converters (DataTable and parameter types) and adapts existing steps/scenarios to the new typed bindings.
Changes:
- Introduces
CucumberTypeConfigwith@DataTableTypeand@ParameterTypeconverters. - Refactors
StepDefinition.theUserProfileto consume a typedList<FieldAssertion>instead ofDataTable. - Updates the “non-existent user” GET scenario to use a different hardcoded ID and switches the GET step to
{userId}.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/test/resources/features/get_user.feature | Updates the non-existent user ID used in the GET scenario. |
| src/test/java/feature/StepDefinition.java | Uses typed DataTable conversion for profile assertions and a custom {userId} parameter type for GET. |
| src/test/java/feature/CucumberTypeConfig.java | Adds Cucumber DataTable and parameter converters (FieldAssertion, UserRequest, userId). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c98eecb to
d05d69d
Compare
|
profotoce59
approved these changes
Apr 17, 2026
Collaborator
profotoce59
left a comment
There was a problem hiding this comment.
C'est clairement beaucoup plus propre pour moi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.





Guide : Utilisation de
@DataTableTypedans les tests CucumberPrincipe
@DataTableTypeest une annotation Cucumber qui convertit automatiquement les lignes d'une DataTable (fichier.feature) en objets Java typés. Plus besoin de parser manuellement lesDataTabledans les steps.Comment ça marche
.feature@DataTableTypedont le type de retour correspond au type attendu par le stepMise en place
1. Créer une classe de converters
Placer un fichier dans le même package que les steps (ex :
feature/). Cucumber le détecte automatiquement.2. Choisir le bon type de converter selon le format de la DataTable
Format A — Table sans en-tête (liste de paires)
Chaque ligne arrive comme une
List<String>:Le step reçoit une
List<FieldAssertion>:Format B — Table avec en-têtes (une ou plusieurs lignes d'objets)
Chaque ligne arrive comme un
Map<String, String>(clé = en-tête) :Le step reçoit une
List<UserRequest>:Format C — Table à une seule ligne (objet unique)
Même DataTable avec en-têtes, mais le step attend un seul objet :
Récapitulatif des signatures
@DataTableTypeList<String> rowList<MonRecord>Map<String, String> rowList<MonRecord>ouMonRecordString cellList<MonType>Bonnes pratiques
CucumberTypeConfig.java) pour centraliser tous les convertersBonus :
@ParameterTypePour les paramètres inline (pas les DataTables) :
When the client call to GET /random-users/42{userId}dans l'expression fait le lien avec le nom de la méthodeuserId().