I have class (CMyFunctions) with some private functions, which is implemented as part of DLL. I need to write test class (CMyFunctions_TEST) to test functions. To test private functions, I need to declare CMyFunctions_TEST as friend of CMYFunctions. It needs change of CMyFunctions declaration (code change to dll). I do not want to make code changes to my DLL to be able to test it.
Are there any good alternatives which does not require code chage to DLL?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Personally it is my view that you shouldn't be testing private methods - only the public methods need testing. By definition that will test the private methods.
Also please don't cross-post:-(
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have class (CMyFunctions) with some private functions, which is implemented as part of DLL. I need to write test class (CMyFunctions_TEST) to test functions. To test private functions, I need to declare CMyFunctions_TEST as friend of CMYFunctions. It needs change of CMyFunctions declaration (code change to dll). I do not want to make code changes to my DLL to be able to test it.
Are there any good alternatives which does not require code chage to DLL?
Personally it is my view that you shouldn't be testing private methods - only the public methods need testing. By definition that will test the private methods.
Also please don't cross-post:-(
Trying to test private method is usually a code smell revealing that you really want to apply the ExtractClass refactoring.
Baptiste.