We have a project which is 10 years old with more than 10 million lines of java code. Now because of some reasons organization decided to write the JUnit test cases for the old code. We are using Mockito JUnit test cases. As part of this change we have to estimate the man days effort. Its very difficult to estimates on the existing code and moreover I am new to the project. Just want to know is there any thumb rule to estimate based on number of lines of code.
I cannot give you a realistic estimate but I can give you a lower bound estimate which will - hopefully - show that the task at hand should not be done. For a helpful line coverage of 80+ percent you will need approximately as many lines of hand-crafted test code as you have production code; so that’s 10 mio LOTC. With 20 years experience of TDD I don’t think I’ve ever written more than 500 LOC of code on a single day (actually it’s probably less than 50 line on most days). So the lower bound is 10000000/500 = 20000 days or 100 people doing nothing but writing tests for a full year.
Does that sound ridiculous? Because it is. Getting a system of that size into a state of reasonable quality requires different means. You might want to read up on strategies for dealing with and replacing legacy systems. Getting all (or most) code under test now is not viable.