I start in the world of SpecFlow, and I ran into the first problem. Regarding my DRY code, I would like to do the following:
There are two scenarios:
Given I am on a product page
And myfield equals todays date
Then...
Given I am on a product page
And myfield equals todays date plus 4 days
Then...
I was hoping to use the following step definition for both variations of my proposal:
[Given(@"myfield equals todays date(?: (plus|minus) (\d+) days)?")]
public void MyfieldEqualsTodaysDate(string direction, int? days)
{
//do stuff
}
However, I keep getting exceptions when SpecFlow tries to parse int? couples. I checked the regex and it definitely parses the script as expected. I know that I could be as rude as method overloading, etc. I was just wondering if SpecFlow supports the idea of ββdefault parameter values ββor even another way to achieve the same effect.
Many thanks
Gavin osborn
source share