Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

I'm a big proponent of unit testing (I'd love to be involved in test driven development). The company I work for seems rather reluctant to spend much effort beyond largely manual end user testing towards the end of development cycles. We have a fairly large solution that has been under development for a couple of years, and I FINALLY got approval to work on an initial unit test suite.

I'd like to be as successful as possible in this effort and convince management to invest more in this area.

What have you done to help justify more unit testing investment, in terms of measured results or other data? Bug tracking results will help, but looking for additional ideas.

share|improve this question

migrated from Jul 5 '11 at 18:13

This question came from our site for professional and enthusiast programmers.

marked as duplicate by gnat, MichaelT, GlenH7, Kilian Foth, Dynamic Jan 28 '14 at 21:26

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Figure out how it'll save them money – James Jul 5 '11 at 17:59
Any good techniques (other than bug tracking results) to show them how it'll save them money? – SDET Jul 5 '11 at 18:04
@razlebe, should I repost the question on stack exchange? – SDET Jul 5 '11 at 18:05
@SDET - no, don't worry - if enough people agree with me, it'll get automatically migrated. – razlebe Jul 5 '11 at 18:10
4…. Already asked and answered. Also…. – S.Lott Jul 5 '11 at 18:28
up vote 8 down vote accepted

IMHO, you shouldn't be in a position where you have to justify your coding methodology. If you are more comfortable with TDD, you should do it.

As far as I know, you are not working in an assembly line where all the processes and movements are calculated and optimized. Your task has plenty of room for initiatives such as the ones your describe.

In fact, it's what I expect from my employees.

But if you really want to justify yourself, S.Lott provided you with two existing question (1 2) in the question comments that contains some arguments for your justification.

share|improve this answer

If you want to show ROI to management, do not unit test, unless you suspect certain specific units of being defective. Instead, test features, aka use-cases, aka scenarios, that will actually occur when the software is being used in the field. The ROI from these is threefold:

  1. it catches bugs that are likely to be encountered in actual use, clearly preventing far more expensive maintenance and support issues. [see below]

  2. it automates some or all of the acceptance-testing process, which saves considerable time and manpower

  3. it illustrates how the components of the software are supposed to be used and are supposed to interact, which makes it much easier for new developers to understand the software system, thus saving time and money on training

I am not a fan of blind unit testing except for the most exacting of software projects. 100% code coverage may be conforting, but it may provide no significant ROI in a practical sense. I'm a big fan of TDD-style feature testing - it is easy for management to comprehend the impact of "if the user enters 1000 in the Crisis field, selects Travesty from the menu, and then clicks the Exponential button, we get an integer overflow error in the database update code", than it would be for him/her to imagine why anyone would care that "uspCrisisManagementFieldPlacementCalculator cannot handle input values over 999 in certain operational modes". It may be the case that the correct way to fix this particular problem is to disallow values greater than 999 in the Crisis field, depending on exactly what your application is supposed to do. In other words, mere unit testing runs the risk of testing things that cannot happen and also of generating "fixes" that ignore the actual context of use. Striving for 100% code coverage, as is often lofted about as a goal of unit testing, may waste serious amounts of time and money, both by testing things that cannot actually happen in practice, and by encouraging fixes and scope creep that do not consider the context of use.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.