Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best strategy to get coding prepared for unit testing

I have a solution that is missing a lot of code coverage. I need to refactor this code to decouple to begin to create unit tests. What is the best strategy? I am first thinking that I should push to decouple business logic from data access from businessobjects to first get some organization and then drill down from there. Since many of the classes don't support single responsible principle, it's hard to begin testing them.

Are there are other suggestions or best practices from taking a legacy solution and getting it into shape to be ready for code coverage and unit testing?

like image 728
leora Avatar asked Dec 06 '22 07:12

leora


1 Answers

Check out Working Effectively with Legacy Code.

like image 90
orip Avatar answered Dec 07 '22 19:12

orip