ExecuteAutomation

Step argument transformation in Specflow

In the last post of specflow, we discussed about scoped bindings, in this post we will discuss how to work with custom types of .Net as parameters for step definitions in specflow.

Argument conversion

In 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 So, how to deal with custom arguments which specflow does not support out of the box ?

Step Argument transformation

There 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 transformation

To achieve step argument transformation following rules needs to be followed This is how a step argument transformation looks like in the code which we will discuss in the video below Here is the complete video of the above discussion

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