Reputation: 499
We just decided to use SpecFlow in for our unit testing and I created the first scenario.
The tests are running fine,except for one of them and it calls a function in my code.
So obviously that test caught a bug in that function.
I put a breakpoint on the first line of the function which the tests calls and Right Clicked on the Specs project and selected Run With Debugger.
The breakpoint in my function though never gets hit, only the breakpoints in the tests.
So my question is "How do you make SpecFlow run with the Debugger so that I can truly debug my code"
Any suggestions are welcome
Thanks
Upvotes: 3
Views: 7957
Reputation: 109
This solution is for Visual Studio (version 2019 at the time of writing this answer):
Upvotes: 2
Reputation: 8534
https://github.com/techtalk/SpecFlow/wiki/Debugging-Tests
<generator allowDebugGeneratedFiles="true">
Upvotes: 0
Reputation: 4786
If you're using Resharper to run your tests you have to change the VS option: Tools -> Options -> Specflow -> Test Runner from Auto to ReSharper
Upvotes: 1
Reputation: 20240
I too have encountered this behaviour. What worked for me is placing a breakpoint in the scenario and also a breakpoint in the step definition file. When you then choose "Run with debugger" you will find that program execution will stop at both breakpoints.
Upvotes: 1