Specflow Steps with Regex
It is possible to use Regular Expressions in the Given, When Then attributes of your step definitions. This gives the developer/tester the ability to reuse Step Definitions.
[Given(@"I have an object with the name '(.+)'")]
public void ExampleStepDefinition(string objectName)
{
...
}
But remember to surround the regex with brackets as Specflow with throw a parameter mismatch error.
Written by Richard Tasker
Related protips
2 Responses
Create post!
We are currently working on this subject in the upcoming "Specflow Cookbook" and It would be great to get your impressions on the chapter dealing with Regular Expressions.
http://specflowcookbook.com/chapters/use-regular-expressions/
over 1 year ago
·
I have read through the chapter.
Really liked the examples, even learned something about RegEx I didn't know.
If you want any other chapters reviewing I would be happy to help.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Bdd
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#