Argument conversionIn Specflow, argument transformations are done effortlessly by itself from a feature to step definition, If we create an step with integer value, then specflow will deal with it automatically Similarly specflow deals with .Net types automatically
- Booleans etc
Step Argument transformationThere comes, Step argument transformation feature of specflow, which can be used to apply a custom conversion step for the arguments of the step definitions. The step argument transformation is a method that provides a conversion from text (specified by a regular expression) or from a Table instance to an arbitrary .NET type.
To achieve step argument transformationTo achieve step argument transformation following rules needs to be followed
- the return type of the transformation is the same as the parameter type
- the regular expression (if specified) is matching to the original (string) argument
- if there are multiple matching transformation available, a warning is provided in the trace and the first transformation is used
Thanks for reading the post and watching the video!!! Please leave your comments and let me know if there is anything I should update in this post. Thanks, Karthik KK