You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by kiragengis March 30, 2024
To give more context to the step, I want to be able to refer to a property value of the class in the step name. This is an example:
public class LogMore
{
[AllureStep("This method logs with more context when {parameter1} is identified within {this.NameThatIdentifiesThisClass}")]
public void ILogWithMoreContext(string parameter1)
{
}
/// <summary>
/// This property uniquely identifies the instances of the class
/// </summary>
public string NameThatIdentifiesThisClass { get; set; }
}
My approach would be to modify AllureStepParameterHelper.GetStepName to receive an instance from AllureStepAspectBase, and then add something similar to this to the if-else statement:
else if (TrySplit(pattern, '.', out var parts2) && parts2.Length == 2 && parts2[0] == "this")
{
// We probably need to do some validation around this line
stepName = stepName?.Replace(match.Value, instance?.GetType().GetProperty(parts2[1]).GetValue(instance).ToString());
}
The text was updated successfully, but these errors were encountered:
Discussed in https://github.com/orgs/allure-framework/discussions/2461
Originally posted by kiragengis March 30, 2024
To give more context to the step, I want to be able to refer to a property value of the class in the step name. This is an example:
My approach would be to modify
AllureStepParameterHelper.GetStepName
to receive an instance fromAllureStepAspectBase
, and then add something similar to this to the if-else statement:The text was updated successfully, but these errors were encountered: