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 Transform header being treated like an object #396

Closed
mmalmeida opened this issue Oct 1, 2012 · 3 comments
Closed

Scenario Transform header being treated like an object #396

mmalmeida opened this issue Oct 1, 2012 · 3 comments

Comments

@mmalmeida
Copy link
Contributor

This was found as I was creating a test case for #395.

A different behaviour is observed between 1.0.10 and 1.0.11 versions of cucumber in handling scenario transforms.

Consider the scenario:

Given the list for module XX:
    |question    |
    | Age         |
    | Height    |
When foo
Then bar

In 1.0.10, the stepdef with the signature public void the_list_below(String moduleName, List questions) (where ScenarioQuestion has a "question" attribute) creates a list of size 2 (age and height).

However, in 1.0.11 it creates a list of size 3 (question, Age and Height).

Why is it treating the header as a ScenarioQuestion object?

See the attached test case where that behaviour is observed (if you change the cucumber version in the pom.xml you'll see the junit test fails): https://github.com/mmalmeida/cucumber-playground/tree/master/cucumber-scenarioObjects

@aslakhellesoy
Copy link
Contributor

I have only given this a quick analysis, and it looks like Cucumber is instantiating an instance per row because the list has a single column, and each single field in the column can be used to create an instance, using ScenarioQuestion(String).

I'll have to think more about this one...

@aslakhellesoy
Copy link
Contributor

It's beacuse the String constructor makes Cucumber think it's a scalar: http://cukes.info/step-definitions.html

Lose the String constructor!

@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants