5

I have two machines with different cultures where the format mm/dd/yyyy is successfully parsed by Specflow (it's a step argument) in one but fails in the other.

I want my tests to be culture independent. So how to configure Specflow to use CultureInfo.InvariantCulture for parsing dates ?

yiabiten
  • 782
  • 8
  • 25

2 Answers2

7

Well, as nobody answered this. My solution for the problem was to edit the App.config file and add <bindingCulture name="en-US" /> in the <specflow> config section.

This forces Specflow, on both machines, to correctly parse MM/dd/yyyy date format.

yiabiten
  • 782
  • 8
  • 25
  • 2
    Thank you for coming back with the answer. Niche knowledge like this can be very valuable and I wish SO found a way how this can be rewarded more than just assigning it a few reputation points, [while programming-101 questions are getting upvoted to the outer atmosphere](http://stackoverflow.com/questions/7074/whats-the-difference-between-string-and-string). – AutomatedChaos Oct 29 '15 at 11:03
0

For those looking for a .NET Core answer, you need to add a specflow.json file, set to Copy always or Copy if newer, to your project.

{
  "bindingCulture": "en-US"
}
James Hyde
  • 657
  • 1
  • 6
  • 23