Skip to content

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

Open
@pgundlupetvenkatesh

Description

@pgundlupetvenkatesh

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 bugDefect / Bug⌛ staleWill soon be closed by stalebot unless there is activity🚦 needs testsNeeds tests

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions