home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / software / 4998 < prev    next >
Encoding:
Text File  |  1992-12-16  |  4.8 KB  |  109 lines

  1. Newsgroups: comp.software-eng
  2. Path: sparky!uunet!munnari.oz.au!ariel.ucs.unimelb.EDU.AU!kowari.cpsg.com.au!johnr
  3. From: johnr@bohra.cpg.oz.au (John Reid)
  4. Subject: Re: Value of High Code Coverage Metrics in Testing - Request for Opinion
  5. Message-ID: <johnr.724486714@pongo.kowari.cpsg.com.au>
  6. Sender: news@kowari.cpsg.com.au (USENET News System)
  7. Nntp-Posting-Host: pongo.cpg.oz.au
  8. Organization: Computer Power Software Group Pty Ltd
  9. References: <1992Dec14.072812.13689@syacus.acus.oz.au> <1992Dec14.095803.15093@lmpsbbs.comm.mot.com>
  10. Date: Wed, 16 Dec 1992 06:18:34 GMT
  11. Lines: 96
  12.  
  13. davidal@comm.mot.com (UK702 DavidAlexander) writes:
  14.  
  15. >In article <1992Dec14.072812.13689@syacus.acus.oz.au>, paulb@syacus.acus.oz.au (Paul Bandler) writes:
  16.  
  17. ><preamble deleted>
  18. >|> I believe we have a tool to measure the %BFA 'Branch Flow Analysis' but
  19. >|> of course the engineers are responsible for producing the test cases to 
  20. >|> exercise the code.
  21. >|> 
  22. >|> I have 3 questions:-
  23. >|> 
  24. >|> 1)  Do people think that this is a valuable metric?
  25. >|> 2)  Is it a cost effective excersize to get engineers to achieve a particular
  26. >|>     %BFA as a completion criteria?
  27. >|> 3)  What is a realistic %BFA to aim for?
  28. >|> Paul Bandler
  29.  
  30. >BFA is a valuable tool for testing. %BFA, as with all unitless numbers, is
  31. >of a more dubious nature.
  32.  
  33. >%BFA does not tell the person looking at it which paths were not tested
  34. >and why. This is important because engineers could, subconsciously or
  35. >otherwise, use their quota of untested branches to avoid testing the more
  36. >complex/niggly areas of code.
  37.  
  38. >The nature of the testing is also important - only if you are programming
  39. >in an interpreted language where syntax must be checked by execution,
  40. >is executing every line of code useful by itself. (You can
  41. >run through every branch of a square root function but it won't
  42. >test for what happens with a negative parameter. There is always a
  43. >temptation to say that a line i++ 'passes because it increments i' without
  44. >checking when it shouldn't.)
  45.  
  46. >As to cost effectiveness this is so dependant upon the available tools,
  47. >maintainance costs, whether or not testability was built into the code etc.
  48. >that any global statement would be rash.
  49.  
  50. >A realistic %BFA target is again dependant upon specific circumstances.
  51. >I don't know if anyone has done any work to find out the %age of
  52. >defects found, against testing coverage and time taken but I would
  53. >be interested to find out. The benefits of higher percentages are not
  54. >linear and certainly peaks.
  55.  
  56. >Setting %BFA as a part of completion criteria is probably worthwhile but
  57. >getting dogmatic about it is probably not. BFA is very useful for helping
  58. >engineers see where more testing is required it is not that useful as an
  59. >exam mark for the testing.
  60.  
  61. >-- David
  62.  
  63. I agree very much with the above. All coverage measures are useful, but
  64. they are only useful if the tests you are performing are independently
  65. verified as "working correctly". In other words, executing the code is all
  66. very well, but you need to know that the results you obtained were the
  67. expected results. Adding 2 and 3 to get 7 may well take you down a path,
  68. but if you leave it at that your program is not working so well...
  69.  
  70. Here we also spend time drawing up plans for testing, and try to design
  71. tests to be easy to verify. I try to persuade those wwriting the code to
  72. always do the following:
  73.  
  74. A.    Identify data values that should be accptable, and those that should
  75.     not be accepted.
  76.  
  77. B.    Identify for selected "good" values what the expected outcome should
  78.     be, and verify that that is what happens.
  79.  
  80. C.    Identify for selected "Bad" values what the expected outcome should
  81.     be, and verify that that is what happens.
  82.     
  83. D.    As a guide values at the boundaries of acceptable ranges should always
  84.     be tested (BOTH SIDES OF THE BOUNDARY).
  85.  
  86.     A value well away from any set boundary should also be tested.
  87.  
  88. I often have to persuade programmers to try data values that should never
  89. be acceptable, but for commercial applications, your code should be robust
  90. enough to deal with any values. If your input program, say, is accepting
  91. data, and only numeric data can be used by the appliication, then you need
  92. to know that if you are silly enough to enter "FRED" the program will
  93. identify your deliberate mistake and tell you about it, rather than
  94. blithely attempting to calculate the size of a concrete beam with a safe
  95. working load of FRED tonnes (How heavy is Fred, anyway ??:-), assuming that
  96. that was what your program was to do.
  97.  
  98. In summary, then coverage measures are useful (we use them a lot here,
  99. mostly the C1 coverage metric), but they are not sufficient, at least I
  100. don't believe they are. 
  101.  
  102.  
  103. --
  104. John Reid                                   ACSnet : johnr@bohra.cpg.oz.au
  105. CP Software Export Pty Ltd,                 Phone  : +61 3 823 0222
  106. 19 Cato Street, Hawthorn 3123 Australia     Fax    : +61 3 824 8068
  107. ACN 006 640 133
  108.