0

I would like to replace my drivers layer from my C# application with simple stubs or mocks. Based on search i have done on web there are several tools supporting this feature e.g.(Microsoft Fakes, NSubstitute...).

My question is if that tools are able to auto find and auto replace every function call from the drivers library to be replaced. To sum up i would like some feedback from experts on how capable it is for such tools to auto generate this functionality.

zeus2
  • 309
  • 2
  • 11
  • It's not clear what you mean by "auto find and auto replace". How is your application referring to your driver layer? Do you have appropriate interfaces already in place? – Jon Skeet Apr 04 '14 at 12:03
  • I already have the layers with the appropriate interfaces in place and working. Now, for testing purposes i want to remove the drivers layer and replace it with stubs/mocks and i am searching for a tool to auto generate these. – zeus2 Apr 04 '14 at 12:06
  • Right, so you use whatever mocking framework you want to get appropriate implementations, and pass those to the code that will use them. It's hard to tell exactly what you're asking, or what you'd want to be "autogenerated". – Jon Skeet Apr 04 '14 at 12:07
  • Are you looking for an [Auto-mocking Container](http://blog.ploeh.dk/2013/03/11/auto-mocking-container)? – Mark Seemann Apr 04 '14 at 12:09
  • Each call to the driver layer API from my Adapter layer (which is a higher layer on top of driver) i want to be replaced by a mock/stub. I have 1000 such different calls from adapter layer to driver layer. – zeus2 Apr 04 '14 at 12:09
  • @MarkSeemann i am new to software testing. I think that what i am asking for is much more simpler than Auto-mocking container. Thank you in advance – zeus2 Apr 04 '14 at 12:14
  • You don't replace the *call* - you replace the implementation which *receives* the call. Have you done any mocking before? If not, I suggest you go through a basic tutorial first, rather than trying to immediately apply an unfamiliar idea in your real application. – Jon Skeet Apr 04 '14 at 12:21
  • @JonSkeet thank you. I understand that i have to create a new layer to replace the driver layer .dll wrapper and will act as call receiver. This layer will include the stub/mocks. Is there any such tool to convert my driver-layer functions into stubs? – zeus2 Apr 04 '14 at 12:38
  • No, you shouldn't need to create a new layer at all, if you've already got all the interfaces in place. But it's very hard to keep discussing this with only a vague idea of what your application looks like. Again - have you done any mocking before? If not, have you worked through a tutorial? – Jon Skeet Apr 04 '14 at 12:55

0 Answers0