1

I am just getting to grips with SpecFlow, and I am trying to create my own implementation of IUnitTestGeneratorProvider in order to override how the test classes are generated.

I'd like to know if it is possible to debug this file. As far as I can tell, the code in the file gets executed on build, and so whenever I start to debug, the code is executed before the debugger is ready.

Is this assumption correct? And can anyone tell me if and how they have successfully debugged an implementation of IUnitTestGeneratorProvider?

Chris Payne
  • 1,700
  • 1
  • 16
  • 33

2 Answers2

1

I would start by having 2 versions of visual studio open, 1 with the project with the IUnitTestGeneratorProvider I want to test in and 1 which has the project which uses the IUnitTestGeneratorProvider. Then I'd attach the debugger from the first to the process of the second and generate the specflow classes. I don't know if this will work but it would be where I would start. If you don't hit the breakpoints in the first VS then I'd check the modules window to make sure that you have the symbols loaded for your IUnitTestGeneratorProvider implementation.

This question has an alternative approach of starting VS as an external program to debug the extensions, but basically the idea is the same.

Community
  • 1
  • 1
Sam Holder
  • 32,535
  • 13
  • 101
  • 181
0

I am temporarily placing the following statement at any place in the IUnitTestGeneratorProvider implementation to trigger a debug session:

if (!Debugger.IsAttached)
 Debugger.Launch();

See here for more information.

millokeller
  • 252
  • 2
  • 12