Closed orifn1 closed 1 month ago
@orifn1 Could you please share what [StepArgumentTransformation]
s do you have in that project?
It seems to be similar what @kaylumah reported at https://github.com/kaylumah/hosting/pull/552#issuecomment-1935668615
I have a lot - 41
[StepArgumentTransformation(@"^examples.(\S+)\s*[or]*\s*(\S*)")]
public string ChangeParameterInBackground(string param, string defaultValue)
{
return _scenarioContext.ScenarioInfo.Arguments.Contains(param)
? (string)_scenarioContext.ScenarioInfo.Arguments[param]
: defaultValue;
}
with 'null' value:
[StepArgumentTransformation(@"^(\<null\>)$")]
public decimal? NullStringNullTransformerDecimal(string key)
{
return null;
}
@orifn1 The ones with string
return type might be the tricky ones. Can you temporarily comment these ones out and rerun (obviously the tests will fail, but hopefully not with a stack overflow.
I will also check it, but I can do it only tomorrow.
It has not helped, I commented out both but the other 39 StepArgumentTransformation were not commented)
@orifn1 do you have a link to the repo containing all these transformations? there might be other problematic ones.
For me it was StepTransformation from string to string; but Table transformation to objects is working
no, there is no public repo
I commented out several StepTransformations, and some tests passed, but not all. So, I believe it is a bug that should be fixed
looks like this code is source of the problem:
Unfortunately, I can't build reqnroll solution locally for now because I have problems with the framework version and do not have enough time to fix it
looks like this code is source of the problem
How did you figure that out? (It might be relevant for the fix as well.)
I am not aware, I just investigated stack trace)
looks like this code is source of the problem
How did you figure that out? (It might be relevant for the fix as well.)
you were right - the problem in this transformation
[StepArgumentTransformation]
public string CustomStringToStringTransformer(string str)
{
if (NullValueRegex.IsMatch(str))
{
return null;
}
return TryReplaceBodyPattern(str, _domainContext);
}
this method returned it recursively because check CanConvert
I will try to handle it with your suggestion in the mentioned issue https://github.com/SpecFlowOSS/SpecFlow/issues/2561
@orifn1 thank you for looking into that. I didn't even remember that I made that comment. :) If you come up with any good workaround, please post it here.
Interessting, that is very similar conversion (so probably same issue)
[StepArgumentTransformation]
public static string ToNullableString(string value)
{
return Constants.NullIndicator.Equals(value, System.StringComparison.Ordinal) ? null : value;
}
Never knew that string -> string
was not supported;
Is that something changed between V3 / V4 (on which Reenrol is based) or did it work by accident on V3?
No this is a regression in SpecFlow v3->v4 or in the Reqnroll porting (unfortunately I had to touch the converters, so it can happen that it was reintroduced during the forking). :(
If any of you could make a simple check with SpecFlow v4-beta to see if the regression was already present there, it would help the investigation.
I have created a very small workaround to fix the stack overflow issue but can not push it into the repo because I do not have access
I just skip transformation if it was applied previously
It is not the best solution but it works)
@orifn1 thx. I will try to integrate this to the codebase next week.
I'm also running into this issue, this transform reproduces it. For us its a blocker to migrate away from SpecFlow.
//Replaces placeholders in the input with correct run time values.
[StepArgumentTransformation]
public string Transform(string input) => Parser.Parse(input);
Reqnroll Version
1.0.1
Which test runner are you using?
MSTest
Test Runner Version Number
3.0.2
.NET Implementation
.NET 7.0
Test Execution Method
Visual Studio Test Explorer
Content of reqnroll.json configuration file
{ "$schema": "https://schemas.reqnroll.net/reqnroll-config-latest.json",
"trace": { "stepDefinitionSkeletonStyle": "RegexAttribute" } }
Issue Description
Steps to Reproduce
just run existing test(migrated from Specflow)
Link to Repro Project
No response