DCSIMG

 Subscribe in a reader

Question: Test Private Methods - Guy kolbis
Monday, November 24, 2008 5:56 AM kolbis

Question: Test Private Methods

After reading Chad Myers post on Do not test private methods, I started thinking...

I have always tested private, internal and public methods using one of the unit testing frameworks: NUnit, MBUnit, .NET Unit Testing Framework and others. Was I wrong?

What do you think?

תגים:

תוכן התגובה

# re: Question: Test Private Methods

Yaron Naveh כתב/ה

Basically it is up to you to decide - Chad says it makes unit tests very fragile. Have you ever caused a mass of unit tests to break due to refactoring?

Personally I also like to test private methods and even though sometimes I need to update them after code changes it increases my confidence. But I choose the private methods to test very selectively and am not insisting of an X% coverage for them.

Monday, November 24, 2008 1:21 PM

# re: Question: Test Private Methods

kolbis כתב/ה

I agree with you and after doing some thinking I also agree with Chad. He has some interesting points. Will soon post about it.

Monday, November 24, 2008 1:59 PM

# Answer: Test Private Methods

Guy kolbis כתב/ה

On my previous post I have asked a question: "Would you test a private method?" I got a good

Tuesday, November 25, 2008 3:23 PM

שלח תגובה

(שדה חובה) 
(שדה חובה) 
(אופציונלי)
(שדה חובה) 

Enter the numbers above: