Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scenario outline Table Value is Getting Cloned on Each Run #1553

Open
pgundlupetvenkatesh opened this issue Jun 17, 2021 · 4 comments
Open
Labels
🐛 bug Defect / Bug ⌛ stale Will soon be closed by stalebot unless there is activity 🚦 needs tests Needs tests

Comments

@pgundlupetvenkatesh
Copy link

Describe the bug
Scenario Outline table value gets appended to the previous iteration value when the table values are same using << operator

To Reproduce
Feature file -

Feature: Testing City Names

  Scenario Outline:
    And I live in '<city>' City
    And I am not from '<city>'

    Examples:
      | city       |
      | Sacramento |
      | Sacramento |

Step Definition file -

And 'I live in {string} City' do |city|
  city << ' City'
  puts "#{city}"
end

And /^I am not from '(.+)'$/ do |city|
  city << ' city'
  puts "#{city}"
end

gemfile -

source 'https://rubygems.org'

gem 'cucumber', '~> 6.1.0'

Expected behavior
Should be
loop 1

I live in Sacramento City
I am not from Sacramento city

loop 2

I live in Sacramento City
I am not from Sacramento city

Context & Motivation
This fails Cucumber feature plans in our automation suite. To fix it right now we are updating << with += but would be great to have << working to append strings.

Screenshots
image

Your Environment

  • Versions used: Cucumber 6.1.0 and Ruby 2.6.4
  • Operating System and version: Windows 10 64bit

Additional context
When Cucumber is downgraded to 6.0.0 << does not clone/append strings and works fine
When I use Cucumber Expressions in step definition I can't reproduce the issue it's only when I use regular expression.
And when table values are not same this issue cannot be reproduced

@mattwynne
Copy link
Member

mattwynne commented Jun 17, 2021

This feels related to #1532, but I might be wrong.

IMO either we need to freeze the argument (so you get an error trying to call << on it) or we need to copy it for each step match.

@mattwynne
Copy link
Member

@pgundlupetvenkatesh thanks for such a concise and clear bug report! Are you interested in helping to fix this?

You can book a pairing session with me at https://calendly.com/mattwynne or you can come and find us in https://cucumber.io/community#slack in the #committers if you want to chat.

@mattwynne mattwynne added 🐛 bug Defect / Bug 🚦 needs tests Needs tests labels Jun 17, 2021
@pgundlupetvenkatesh
Copy link
Author

@mattwynne you 're welcome. I am pretty occupied with work right now so maybe some other time.

@stale
Copy link

stale bot commented Apr 14, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in two months if no further activity occurs.

@stale stale bot added the ⌛ stale Will soon be closed by stalebot unless there is activity label Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Defect / Bug ⌛ stale Will soon be closed by stalebot unless there is activity 🚦 needs tests Needs tests
Projects
None yet
Development

No branches or pull requests

2 participants