开发者

SpecFlow and Testing with the Debugger

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 开发者_JS百科run with the Debugger so that I can truly debug my code"

Any suggestions are welcome

Thanks


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.


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


This solution is for Visual Studio (version 2019 at the time of writing this answer):

  1. Debug > Options > General
  2. Disable "Enable Just My Code".


https://github.com/techtalk/SpecFlow/wiki/Debugging-Tests

<generator allowDebugGeneratedFiles="true">
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜