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

ValueRetriever not being applied when DataSet is part of Example in Scenario Outline #2754

Open
stevenmolencsat opened this issue Jul 2, 2024 · 0 comments
Labels

Comments

@stevenmolencsat
Copy link

SpecFlow Version

3.9.40

Which test runner are you using?

MSTest

Test Runner Version Number

3.9.40

.NET Implementation

.NET 6.0

Project Format of the SpecFlow project

Sdk-style project format

.feature.cs files are generated using

SpecFlow.Tools.MsBuild.Generation NuGet package

Test Execution Method

Visual Studio Test Explorer

SpecFlow Section in app.config or content of specflow.json

No response

Issue Description

When trying to use a ValueRetriever for a Scenario Outline Example, the contents of the cell are passed to each scenario, instead of the contents from the ValueRetriever.

Steps to Reproduce

Scenario Outline: deserialize xyz
	Given I have a new xyz
	When I deserialize the data from '<StringFile>'
	Then It should give me a valid object

    Examples: 
    | StringFile                              |
    | Examples\\XML\\xyz.xml |
[Binding]
public static class Hooks
{
    [BeforeTestRun]
    public static void BeforeTestRun()
    {
        Service.Instance.ValueRetrievers.Register(new StringFileValueRetriever());
    }
}
{
    public bool CanRetrieve(KeyValuePair<string, string> keyValuePair, Type targetType, Type propertyType)
    {
        if (!keyValuePair.Key.Equals("StringFile", StringComparison.Ordinal))
        {
            return false;
        }

        if (File.Exists(keyValuePair.Value))
        {
            return true;
        }

        return false;
    }
    public object Retrieve(KeyValuePair<string, string> keyValuePair, Type targetType, Type propertyType)
    {
        return File.ReadAllText(keyValuePair.Value);
    }
}

Within the step definition, I am getting Examples\XML\xyz.xml

Link to Repro Project

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant