SpecFlowOSS / SpecFlow

#1 .NET BDD Framework. SpecFlow automates your testing & works with your existing code. Find Bugs before they happen. Behavior Driven Development helps developers, testers, and business representatives to get a better understanding of their collaboration
https://www.specflow.org/
Other
2.22k stars 752 forks source link

Unable to Register / use NullValueRetriever #2619

Closed SeanKilleen closed 1 year ago

SeanKilleen commented 1 year ago

SpecFlow Version

3.9.74

Which test runner are you using?

xUnit and NUnit both have the same failure.

Test Runner Version Number

.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

Command line – dotnet test (also fails via NCrunch and ReSharper test runner)

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

Not using either (perhaps that's part of the issue?)

Issue Description

I am unable to register and use the NullValueRetriever provided by SpecFlow.

I've produced a minimal reproduction at https://github.com/SeanKilleen/2022-07_SpecFlow_NullValueHelperIssue_Reproduction.

I use the example right out of the documentation to load a null value retriever, but it does not appear to actually provide a null value to the string in my file.

Steps to Reproduce

See minimal reproduction at https://github.com/SeanKilleen/2022-07_SpecFlow_NullValueHelperIssue_Reproduction

Fails via dotnet test, and fails via the NCrunch and ReSharper runners as well.

Link to Repro Project

https://github.com/SeanKilleen/2022-07_SpecFlow_NullValueHelperIssue_Reproduction

SeanKilleen commented 1 year ago

Hope this is just a strange mistake I'm making in trying to use it for the first time. If it turns out to be something about the docs etc. that could be improved, I'm happy to take that on as a follow-up task.

SabotageAndi commented 1 year ago

ValueRetrievers are only for the Assists helper for DataTables. For normal parameters you need a StepArgumentTransformation.

Tbh, I also needed 10 minutes to remember this.

SeanKilleen commented 1 year ago

Perfect, thank you!

From a product perspective, it may make sense to merge the concepts. But for now I'm totally content to have this resolved and I'll update the docs to point people in the right direction.

SabotageAndi commented 1 year ago

Yeah, we tried in the past. Sadly the two concepts are so different integrated into SpecFlow that we would probably end with a third one. Thanks for the docu PR.

github-actions[bot] commented 1 year ago

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.