Reqnroll icon indicating copy to clipboard operation
Reqnroll copied to clipboard

Making VerifyAllColumn case-insensitive

Open algirdasN opened this issue 8 months ago • 5 comments

🤔 What's changed?

Made the comparison case-insensitive in the method that is used to verify that all columns in the table are bound to a member on the object that is being created.

⚡️ What's your motivation?

In order to use VerifyAllColumnsBound option when creating an object instance from a table the field key must match the member's name exactly. This is an inconsistent behavior with instance creation as the members are matched ignoring the case. This makes enabling this option frustrating as one have to go back to feature files and fix all the keys.

🏷️ What kind of change is this?

  • :zap: New feature (non-breaking change which adds new behaviour)

📋 Checklist:

  • [x] I've changed the behaviour of the code
    • [x] I have added/updated tests to cover my changes.
  • [x] My change requires a change to the documentation.
    • [x] I have updated the documentation accordingly.
  • [x] Users should know about my change
    • [x] I have added an entry to the "[vNext]" section of the CHANGELOG, linking to this pull request & included my GitHub handle to the release contributors list.

This text was originally taken from the template of the Cucumber project, then edited by hand. You can modify the template here.

algirdasN avatar Apr 24 '25 12:04 algirdasN

I was thinking whether this would be breaking and thought that any bug introduced here would already exist since currently Reqnroll will not properly populate instances that have two or more members with matching case-insensitive names.

In any case I've added a property to InstanceCreationOptions and added unit tests to test default and new behavior.

While doing this I've found an interesting behavior of RequireTableToProvideAllConstructorParameters flag. With it unset (default behavior) it will not allow for any valid members that are not used in the constructor (invalid names are ignored and are allowed if not verified). I'm not entirely sure if this is intended because that does not correspond to the name of the flag.

algirdasN avatar Apr 24 '25 21:04 algirdasN

While doing this I've found an interesting behavior of RequireTableToProvideAllConstructorParameters flag. With it unset (default behavior) it will not allow for any valid members that are not used in the constructor

Could you give an example of this? Thanks!

304NotModified avatar Apr 24 '25 21:04 304NotModified

Please update also the changelog :) It's now a feature :)

304NotModified avatar Apr 24 '25 21:04 304NotModified

Ow I almost forgot, Could you please update https://github.com/reqnroll/Reqnroll/blob/main/docs/automation/datatable-helpers.md?plain=1

See https://docs.reqnroll.net/latest/automation/datatable-helpers.html#instancecreationoptions

Thanks a lot!

304NotModified avatar Apr 24 '25 22:04 304NotModified

I've updated the docs. Please let me know if something should be changed. Thank you for guiding me through the process.

algirdasN avatar Apr 24 '25 22:04 algirdasN

@algirdasN Thank you for the contribution! According to our guidelines I have invited you to the Reqnroll "contributors team". Congrats! 🎉 If you accept it, you will be able to make pull requests easier in the future.

You are also welcome on our discord server: https://go.reqnroll.net/discord-invite

gasparnagy avatar May 27 '25 06:05 gasparnagy