Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pro's and Con's of unit testing after the fact

I have a largish complex app around 27k lines. Its essentially a rule drive multithreaded processing engine, without giving too much away Its been partially tested as it's been built, certain components.

Question I have, is what is the pro's and con's of doing unit testing on after the fact, so to speak, after its been implemented. It is clear that traditional testing is going to take 2-3+ months to test every facet, and it all needs to work, and that time is not available really.

I've done a fair bit of unit testing in the past, but generally it's been on desktop automation or LOB apps, which are fairly simple. The app is itself is highly componentized internally, interface driven really. I've not decided on what particular framework to use. Any advice would be appreciated.

What say you.

like image 267
scope_creep Avatar asked Mar 22 '10 16:03

scope_creep


People also ask

What are pros and cons of unit testing?

Advantages of unit testing are that it reduces or prevents production bugs, increases developer productivity, encourages modular programming. Disadvantages are that it is time-consuming, can't be challenging to cover all the code, and won't catch all bugs.

What is the major disadvantage of unit testing?

Limitations of Unit Testing Unit testing cannot detect integration or interfacing issues between two modules. It cannot catch complex errors in the system ranging from multiple modules. It cannot test non-functional attributes like usability, scalability, the overall performance of the system, etc.

What happens if unit testing is not done?

If any of the unit tests have failed then the QA team should not accept that build for verification. If we set this as a standard process, many defects would be caught in the early development cycle, thereby saving much testing time. I know many developers hate to write unit tests.


1 Answers

I think there are several advantages to unit testing existing code

  • Regression management
  • Better understanding of the code. Testing it will reveal cases you did not anticipate and will help define the behavior of the code
  • It will point out design deficiencies in the code as you stuggle to test poorly defined methods.

But I think it's more interesting to consider the cons of unit testing code. AFAIK, there are no cons. All of the time spent adding tests will pay for themselves even in everything but the shortest of time cycles.

like image 92
JaredPar Avatar answered Sep 22 '22 18:09

JaredPar