Skip to content

[Dart] Improve test coverage & CI enforcement - #699

Open
Fried-man wants to merge 12 commits into
cucumber:mainfrom
Fried-man:test/dart-maximum-coverage
Open

[Dart] Improve test coverage & CI enforcement#699
Fried-man wants to merge 12 commits into
cucumber:mainfrom
Fried-man:test/dart-maximum-coverage

Conversation

@Fried-man

@Fried-man Fried-man commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🤔 What's changed?

The dart solution now has full line coverage via unit test by:

  • excluding generated files from coverage reporting
  • refactoring private methods to be public so they are testable
  • adding more tests

Also, the dart CI now enforces full line coverage.

⚡️ What's your motivation?

Outside of best practices, the low line coverage was brought up in this issue.

🏷️ What kind of change is this?

  • 🏦 Refactoring/debt/DX (improvement to code design, tooling, etc. without changing behaviour)

♻️ Anything particular you want feedback on?

N/A

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

This text was originally generated from a template, then edited by hand. You can modify the template here.

- Updated `generateMessages` to utilize a new `generateMessagesWithParser` function for improved parsing.
- Introduced `GherkinDocumentParser` type for better type safety.
- Renamed `_pickleStepType` to `pickleStepType` for consistency.
- Enhanced `GherkinDocumentBuilder` by exposing `transformNode` method.
- Added tests for parser error handling and step type assignment.
@Fried-man
Fried-man marked this pull request as draft August 25, 2026 02:08
@Fried-man Fried-man changed the title Test/dart maximum coverage [Dart] Full test coverage & CI enforcement Aug 25, 2026
@Fried-man
Fried-man marked this pull request as ready for review August 25, 2026 02:38

@mpkorstanje mpkorstanje left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No. Please only writing meaning full tests and accept a coverage ratio below 100%.

I didn't review everything because you're using generative AI. Please extrapolate from these highlights:

  • Don't use testdata/{good,bad}. That's for the acceptance tests, don't duplicate them.
  • Don't duplicate functionality already covered by the acceptance tests.
  • transformNode shouldn't be made public just for testing, nor should it be be tested in isolation. Though I don't think it needs coverage at all based on the previous point.

@Fried-man

Copy link
Copy Markdown
Contributor Author

accept a coverage ratio below 100%

What minimum coverage requirement would you prefer?

@Fried-man
Fried-man marked this pull request as draft August 31, 2026 22:04
@mpkorstanje

mpkorstanje commented Aug 31, 2026

Copy link
Copy Markdown
Member

It's up to you to work out what can be reasonably achieved without duplicating the acceptance tests. For reference, in Java, excluding the generated parser, I've got 95% of instructions covered and 83% of all branches. But you shouldn't expect similar numbers because the structure of Dart is meaningfully different.

@Fried-man Fried-man changed the title [Dart] Full test coverage & CI enforcement [Dart] Improve test coverage & CI enforcement Sep 1, 2026
@Fried-man
Fried-man marked this pull request as ready for review September 1, 2026 00:31
@Fried-man

Copy link
Copy Markdown
Contributor Author

The public API surface is now completely unmodified. The behavior is the same too.

@mpkorstanje
mpkorstanje self-requested a review September 3, 2026 09:57
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