Fix: Remove Extra Curly Braces from Data Table Variables in Scenario Outlines#111
Merged
olexale merged 9 commits intoSep 22, 2025
Conversation
olexale
reviewed
Sep 21, 2025
Owner
olexale
left a comment
There was a problem hiding this comment.
Hey, thanks for the PR! 🙌 That’s definitely a bug, so I really appreciate you fixing it. Could you please revert the changes to the example app, though?
I feel that data tables should be used with caution: they don’t allow compile-time type validation and can break at runtime if someone accidentally changes a type. On top of that, I find them harder to read. Even in your artificial example, something like:
Then I see <counter> counter value on <color> background colorwould be much clearer.
Since I’d prefer not to promote this functionality, I think it’s best to exclude it from the example.
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.
🐛 Problem
When using BDD scenario outlines with data tables containing variables from the Examples table, the generated Dart code incorrectly wrapped variable values in extra curly braces
{}, causing invalid Dart syntax as reported in #110.Before (Broken):
After (Fixed):
🔧 Root Cause & Solution
Issue Analysis
The bug was in
lib/src/scenario_generator.dartin the_replacePlaceholders()function at line 131:This function indiscriminately wrapped all placeholder substitutions in curly braces, including data table variables where they shouldn't be wrapped.
Core Fix
_replacePlaceholders()→_replacePlaceholdersInLine()LineType.dataTableStep)🧪 Testing & Validation
Comprehensive Test Coverage
'Scenario Outline with data table variables'test intest/data_tables_test.dartReal-World Example
📋 Files Changed
lib/src/scenario_generator.darttest/data_tables_test.dartexample/*✅ Verification
🎯 Impact
Resolves: Issue #110 - Data table variables incorrectly wrapped in curly braces
Enables: Proper BDD testing with scenario outlines using data tables
Maintains: Full backward compatibility with existing features
This fix ensures that generated Dart code is syntactically correct and tests can execute properly when using scenario outlines with data table variables.