Testing Departments are for Losers
Join the DZone community and get the full member experience.Join For Free
i understand that this is a very strong statement and i’m definitely not trying to insult anyone; so apologies in advance. i’m trying to challenge the belief that testing is mandatory and that there should be one testing resource for every two developers. quality development is about quality assurance and zero defects not about having testing departments.
one testing resource for every two developers is not a good solution
quality assurance (qa) is about making a positive statement about product quality. qa is about positive assurance, which is stating, “ we are certain that there are few, if any, defects in this product. ” airplanes are a product with quality assured, the manufacturers will stand by their quality and the statistics back them up. contrast this with this article or this article which wonders what would happen if microsoft made airplanes — would you fly in them?
he reality is that most testing departments simply discover defects and forward them back to the engineering department to fix. by the time the software product gets released we are basically saying, “
we got rid of as many defects as we could find before management forced us to release this product, however, we really have no idea how many other defects are in the code
”. this is not assuring quality; at best you get
out of this.
everyone understand that buggy software kills sales (and start-ups ), however, testing is often an after thought in many organizations. when software products take longer than expected they are forwarded to the testing department. the testing department is often expected to test and bless code in less time than allocated.
to compound problems, many testing departments don’t even receive proper requirements against which to test the code and/or sufficient tools to work with. large testing departments and/or large amounts of manual testing are not healthy or efficient.
calling defects “bugs” trivializes an important issue
defects are not introduced into software by goblins and elves. defects are injected into the code by developers that:
- don’t understand the requirements or architecture
- misunderstand how to use their peer’s components
- misunderstand 3rd party libraries
- having a bad day because of home troubles or work environment
- are careless because someone else will test their code
defects are injected by the team
no one is more aware of how code can break down than the developer who writes it. any line of code that is written without concentration and planning becomes a potential defect. it is impossible for testers to understand every pathway through the code and make sure that every possible combination of variables is properly taken care of.
there are many techniques that can increase code quality and dramatically reduce the amount of testing that is necessary:
- test driven development (tdd)
- database driven testing
- design by contract (dbc)
- pair programming
- minimizing cyclomatic complexity
- using static and dynamic code tools
- proper code planning techniques
test driven development
properly written tests require a developer not only to think about what a code section is supposed to do but also plan how the code will be structured. if you know that there are five pathways through the code then you will write five tests ahead of time. a common problem is that you have coded n paths through the code when there are n+1 conditions.
tdd is white box testing and can reach every pathway that the developer codes. tdd is proactive and can test pathways from end to end, it does not just have to be used for unit testing. when tdd is hooked up to a continuous integration engine then defects are located and fixed before they make it to testing.
database driven testing
using actual test data to test existing routines during development is an excellent way to make sure that there are fewer production problems. the test data needs to be a copy (or subset) of production data.
database driven testing can also be hooked up to a continuous integration engine and prevent defects from getting to testing.
design by contract
the eiffel programming language introduced design by contract (dbc). dbc is orthogonal to tdd because its goal is to ensure that the contract defined by the preconditions and postconditions for each function call is not violated. dbc can be used in virtually any language for with their is an aspect oriented programming (aop) solution.
during development, the minute a developer violates the expected contract of any function (his or a peers) then the developer will get feedback to fix the problem before it gets to testing.
since the 1970s we have statistical evidence that one of the best ways to eliminate defects from code is through inspections. inspections can be applied to the requirements, design, and code artifacts and projects that use inspections can eliminate 99% of the defects injected into the code. self inspections are not optional and software professionals do inspections .
each hour of inspections will save you 4 hours of testing
pair programming can be selectively used to prevent and eliminate defects from code. when developers work in pairs they not only review code as quickly as possible but also learn productivity techniques from each other. pair programming should only be done on complex sections of code.
pair programming not only eliminates defects but allows developers to get enough feedback that they can prevent defects in the future.
minimizing cyclomatic complexity
there is evidence that routines with high cyclomatic complexity will have more latent defects than other routines. this makes sense because the number of code pathways goes up dramatically as cyclomatic complexity increases and increases the chance that the developer does not handle all of them. in most cases, testing departments can not reproduce all of the pathways in routines of high cyclomatic complexity.
use dynamic and static code checking
there are many code problems caused by a careless use of pointers and other powerful language constructs. many of these problems can be detected by having the development team use dynamic and static code checking problems.
proper code planning techniques
there are developers that try to write code at the keyboard without planning, which is neither efficient nor effective. this is like having to do errands in 5 locations and driving to the locations randomly — you might get your errands done, but odds are it won’t be efficient.
watts humphrey talks directly to the idea of planning in the personal software process . in addition techniques like diagramming with uml or using decision tables can go a long way to thinking through code structure before it is implemented.
developers are the ones who inject defects into the code and therefore they are the best line of defense to remove them. the developer has the best information on what needs to be tested in his code at the time that he writes it. the longer it takes for testing or a customer to discover a code defect the longer the developer will spend in a debugger chasing down the problem.
the goal of development should be to catch defects early ; this is the only way to assure quality. hence quality assurance starts and finishes in the development department, not the testing department.
Published at DZone with permission of Dalip Mahal, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.