home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / windows / x / apps / 887 < prev    next >
Encoding:
Text File  |  1992-08-31  |  35.6 KB  |  791 lines

  1. Newsgroups: comp.windows.x.apps
  2. Path: sparky!uunet!vicorp!ron
  3. From: ron@vicorp.com (Ron Peterson)
  4. Subject: Automated testing
  5. Message-ID: <1992Aug31.193740.3729@vicorp.com>
  6. Organization: V. I. Corporation, Northampton, Massachusetts
  7. Date: Mon, 31 Aug 1992 19:37:40 GMT
  8. Lines: 781
  9.  
  10. Here's an addendum to Vonn Marsch's summary of responses about
  11. automated testing of X applications.  I asked a similar question and
  12. received somewhat different replies.  In particular, it was quite
  13. interesting to learn a little about how others go about testing.
  14. (Some use college students, some use regression, some develop
  15. their own tools, some purchase tools.)
  16. If you have experience testing medium to large graphic applications
  17. please send me a note describing what you worked on and how you
  18. approached it.  If I get enough of them I'll post another summary.
  19.  
  20. Here's a description of my experience to get things started:
  21.  
  22.    VI Corp. markets a graphic interface prototyper called DataViews.
  23. DataViews is built around 'views' which are 2D collections of graphical
  24. objects (such as lines, rectangles, graphs, input widgets, images, etc.)
  25. The product consists primarily of DVdraw (a layout and drawing editor which
  26. also lets you define dynamics for graphical objects and define programming
  27. rules for the way objects and views change and behave) and DVtools (a
  28. library of graphics routines which users can use to control and modify
  29. views, objects, event-handlers, etc.)  Other related products are
  30. starting to come on line also such as DVXDesigner---an X widget layout
  31. editor and code generator that allows DataViews views to display in
  32. a drawing area widget.
  33.    I've been with the company for about three years in the testing
  34. department and am the primary designer and coder of new tests.
  35. When I first arrived here the testing philosophy was "the developers
  36. are done with it, now you test it before we ship it in a few weeks."
  37. As the company has grown things have changed to where we currently
  38. view testing as part of the design process for the products.  Hence, 
  39. I am investigating trying to automate some of our testing.  Towards 
  40. that end I've tried writing a few things in-house such as an event 
  41. recorder/player and a view tester.  The event-recorder/player was a 
  42. failure because it took longer to record the tests than to do them 
  43. manually and since the user interface kept changing I had to keep 
  44. starting over to record the tests.  Eventually we ran out of time 
  45. and reverted to manual testing.  The view tester is currently being 
  46. used and with a little work looks like it will be a valuable tool 
  47. for finding memory leaks, run-time errors, and crashes.  My current 
  48. thinking is that an X based event recorder/playback tool combined 
  49. with a bitmap comparer (that uses compressed bitmaps) might be made 
  50. independent of the user interface as well as being easy to port to 
  51. the 30+ Unix and VMS machines we support.  By using X and being 
  52. careful to control window size and fonts, a single automated test 
  53. suite might be devised that could run on most or all platforms.
  54.   Currently all of our testing tools have been developed in-house and
  55. many rely on the prototype building ability of DataViews which allows
  56. us to create interactive tests without writing code.  Some code has
  57. been written to test drivers on a function by function basis, which has
  58. proved valuable, but there has never been enough time to write test code 
  59. for every function in the library (and I see less benefit in such tests
  60. than I used to.)  Demo and example code also form a critical part of
  61. our testing process since they are designed to be similar to applications 
  62. our customers would write.  Still, much of testing involves sitting
  63. and staring at the screen while clicking and moving a mouse.  This
  64. is the most time consuming and dull part of testing and is the part
  65. we'd like most to automate.
  66.  
  67. ron@vicorp.com or uunet!vicorp!ron
  68.  
  69.  
  70. -----------------------------------------------------------------------------
  71. >From: uunet!cd.amdahl.com!wdc50 (Winthrop D Chan)
  72. >For PD, take a look at TCL, GCT, and EXPECT.The last two are based on TCL. I've
  73. >heard good things they are all supposed to be able to handle keyboard & mouse
  74. >event recording/playback on multiple windows.
  75.  
  76. I downloaded a copy of TCL.  So far I haven't seen anything about it being
  77. able to handle keyboard and mouse events.  If it does handle them, then
  78. I get the impression you have to link some TCL code into your executable;
  79. sounds a lot like REXX.  GCT has nothing to do with TCL (an extensive
  80. note from the creator of GCT is included below.)
  81. Here's an excerpt from the TCL README:
  82.  
  83. >Tcl
  84. >
  85. >by John Ousterhout
  86. >University of California at Berkeley
  87. >
  88. >This directory contains the sources for Tcl, an embeddable tool command
  89. >language.  For an introduction to the facilities provided by Tcl, see
  90. >the paper ``Tcl:  An Embeddable Command Language'', in the Proceedings
  91. >of the 1990 Winter USENIX Conference.
  92.  
  93.  
  94. I also found a copy of EXPECT which is indeed based on TCL:
  95.  
  96.  
  97. >This is the README file from "expect", a program that performs
  98. >programmed dialogue with other interactive programs.  It is briefly
  99. >described by its man page, expect(1).  More examples and further
  100. >discussion about implementation, philosophy, and design are in
  101. >"expect: Curing Those Uncontrollable Fits of Interaction" by Don
  102. >Libes, Proceedings of the Summer 1990 USENIX Conference, Anaheim,
  103. >California, June 11-15, 1990.
  104. >
  105. >expect was designed and written by Don Libes, January - April, 1990.
  106.  
  107. >NAME
  108. >     expect - programmed dialogue with interactive programs
  109. >
  110. >SYNOPSIS
  111. >     expect [ -d ] [ -c cmds ] [[ -f ] cmdfile ] [ args ]
  112. >
  113. >INTRODUCTION
  114. >     expect is a program that "talks" to other  interactive  pro-
  115. >     grams  according  to a script.  Following the script, expect
  116. >     knows what can be expected  from  a  program  and  what  the
  117. >     correct  response  should  be.  An interpreted language pro-
  118. >     vides branching and high-level control structures to  direct
  119. >     the  dialogue.   In  addition, the user can take control and
  120. >     interact directly when desired, afterward returning  control
  121. >     to the script.
  122. >
  123. >     The  name  "expect"  comes  from  the  idea  of  send/expect
  124. >     sequences  popularized  by uucp, kermit and other modem con-
  125. >     trol programs.  However unlike uucp, expect  is  generalized
  126. >     so  that it can be run as a user-level command with any pro-
  127. >     gram and task in mind.  (expect can actually talk to several
  128. >     programs at the same time.)
  129. >
  130. >     For example, here are some things expect can do:
  131. >
  132. >          +   Cause your computer to dial you back, so  that  you
  133. >              can login without paying for the call.
  134. >
  135. >          +   Start a game (e.g., rogue) and if the optimal  con-
  136. >              figuration  doesn't  appear,  restart it (again and
  137. >              again) until it does, then  hand  over  control  to
  138. >              you.
  139. >
  140. >          +   Run fsck, and in response to its questions,  answer
  141. >              "yes",  "no"  or give control back to you, based on
  142. >              predetermined criteria.
  143. >
  144. >          +   Connect to another network or BBS (e.g., MCI  Mail,
  145. >              CompuServe) and automatically retrieve your mail so
  146. >              that it appears as if it  was  originally  sent  to
  147. >              your local system.
  148.  
  149. -----------------------------------------------------------------------------
  150. From: uunet!euclid.JPL.NASA.GOV!pjs (Peter J. Scott)
  151.  
  152. If you have Motif 1.2 then it has a QA scripting language for
  153. this purpose.  Even compares windows.  Only Motif apps, though.
  154. -----------------------------------------------------------------------------
  155. From: uunet!cbnea.att.com!tr (Aaron L Hoffmeyer)
  156.  
  157. I encourage you to contact Dr. Bill Wolters at w.j.wolters@att.com
  158.  
  159. Bill is working on a front-end to a commercial application called CAPBAK,
  160. which in raw form, is, to a limited degree, the kind of tool you are
  161. looking for.  However, as Bill will be able to tell you, one must spend
  162. a great deal of effort in making it a solid, useable tool.  Bill can
  163. give you specs, but, considering that he has worked with this tool for a
  164. year and it will probably take another year to make it the end-all,
  165. be-all tool that he would like, I feel I must warn you that purchasing
  166. such a tool and putting it to use, are not one and the same.
  167.  
  168. Bill's really leading edge with this technology, he has presented at
  169. some conference, maybe USENIX, quite recently, so he knows where the
  170. market is.
  171. [I investigated CAPBAK about two years ago.  We decided not to use it
  172. because it was more than we could afford at the time (being a small
  173. company) and it wasn't portable to the 20+ Unix and VMS platforms
  174. our product ran on.  It is a tool for capturing mouse and keyboard
  175. events and then replaying them.  It was designed to be used in
  176. conjunction with some other testing tools written by the same
  177. company which, I think, is Software Research, Inc.]
  178. -----------------------------------------------------------------------------
  179. From: GAMBLE <uunet!heifetz!image!dos!gamble>
  180.  
  181.  We have looked here for automated tools, and I can pass on what
  182.  little we have learned.
  183.  
  184.  * We do not like the 'total solution' packages. Instead we use a
  185.  varity of small tools and utilities.
  186.  * Software Management News magazine is a good source for tools.
  187.      SMN (415) 969-5522
  188.  * We use tools from Software Research (Unix) - expensive but ok. has
  189.  graphic compare capabilities
  190.  * C-Cover for code coverage analysis - not good for huge programs
  191.  * Microsoft Test for Windows applications - nice easy to use
  192.  
  193.  We have an extensive list of testcases and usually hire college
  194.  co-ops to run the tests. It provides them with valuable experience,
  195.  and we get the testing done.
  196.  
  197.  For automation, I have had better luck using keyboard cursor capture
  198.  rather than mouse capture. Our graphic screens change resolution from
  199.  different graphic boards so mouse movement is not always accurate. We
  200.  have so far been able to save our graphic images as files, and use a
  201.  file compare program with more success. We use ExDiff from Software
  202.  Research that allows us to use byte offsets to eliminate time and
  203.  date tags, or version numbers imbedded in our graphic files.
  204.  
  205.  Mostly be cautious of software that says they are the total
  206.  solution. Use many small useful utilities, and keep track of things
  207.  by using a bugs database. (We wrote our own using DBase IV for Unix)
  208. -----------------------------------------------------------------------------
  209. From: Jim Curran <uunet!cis.ohio-state.edu!jim>
  210.  
  211. XTest and XTrap are extensions to the X server.  Extensions provide additional
  212. capabilities over and above what is provided by a "vanilla" server.  It is
  213. unfortunate, but in order to use these extensions (and others) you must
  214. rebuild the X server.  This may not be a hassle for your X developer but
  215. it does take a little extra time and patience.  Once the extension is installed(you can list your extensions by running xdpyinfo) you can use calls to the
  216. extension library (libXext.a) and it will talk to the server's extensions
  217. for you.
  218.  
  219. XTest and XTrap are (as I recall) copyrighted by HP and Dec, respectively.
  220. However, the copyright is one of those "It belongs to us but you can
  221. do anything you want with it" types of copyrights.  In other words, you
  222. can have it.
  223.  
  224. As I mentioned, XTrap is on export.lcs.mit.edu.  Here's the confusing part
  225. to me:  XTest seems to have come out around the time that R4 appeared and seemsto have been part of the official MIT dist (I could be wrong).  I have not
  226. encountered the XTest extension by itself EXCEPT when I snagged the package
  227. called xrecplay from export.  It contains the extension and some special
  228. stuff for Suns.  I don't really feel like grabbing the R4 dist and
  229. looking around for XTest but my guess is that it is there.  If it is not,
  230. then you can get it from xrecplay and beat it into usefulness.
  231.  
  232. I've spent the last few weeks beating XTest into submission for my purposes
  233. (a program which does demos - moves the mouse, keyboard hits, voice etc...)
  234. and I can say that it more or less works.  I looked at XTrap and it was very
  235. elaborate and came with a better manual but it added *lots* to our X server
  236. which was something I couldn't have. (XTest ~20K, XTrap ~200K).
  237. -----------------------------------------------------------------------------
  238. From: Brian Marick <uunet!cs.uiuc.edu!marick>
  239.  
  240. Capture/playback tools and graphics image "differencers": there are
  241. several out there.  Two I have in my tools file are from Software
  242. Research (800-942-7638) and Mercury (408) 982-0100.  I haven't used
  243. either.  DEC also has one, which may be of interest for VMS.
  244. fullerton@clt.enet.dec.com may be the person to talk to.
  245.  
  246. You may have problems with portability, not to mention price, if
  247. you're wanting to use these on several machines.
  248.  
  249. I don't believe any of the commercial tools do anything more than
  250. bitmap comparisons, which will cause problems with spurious
  251. differences and storing huge bitmaps (Mercury compresses the bitmaps,
  252. I think, but that's still a lot of data per test).
  253.  
  254. ---
  255. Automatic test generation does not work well, except in specialized
  256. circumstances.
  257.  
  258. If you have a large testing problem like this, don't worry about path
  259. coverage.  Worry about writing good tests at the system or subsystem
  260. level, based on what the program is supposed to do, what the users are
  261. likely to do, and potential implementation errors.  Measure coverage
  262. later, to point out problems with your testing.  (I distribute a free
  263. coverage tool that runs on most of the machines you mentioned, but not
  264. on VMS - details below.)  I can send you a paper on "three ways to
  265. improve your testing", either postscript or hardcopy.  It talks about
  266. some sensible tactics in situations like yours.
  267.  
  268. If you want lots of detail about testing, I teach a course in testing
  269. subsystems and I make my living consulting in testing.  (217)351-7228
  270. --
  271.  
  272. One upcoming conference is the Pacific Northwest Software Quality
  273. Conference, Oct 19-21, in Portland.  Call Pacific Agenda (503)
  274. 223-8633 for details.  It was pretty good last year.
  275.  
  276. IEEE Software has had some good practitioner-oriented articles about
  277. testing in recent years.
  278.  
  279. I run a mailing list on testing research
  280. (testing-research-request@cs.uiuc.edu).  It's pretty dead, unfortunately.
  281.  
  282. Brian Marick, marick@cs.uiuc.edu, uiucdcs!marick, marick@testing.com (pending)
  283. Testing Foundations:  Consulting, Training, Tools.
  284. Freeware test coverage tool:  see cs.uiuc.edu:pub/testing/GCT.README
  285.  
  286. ====
  287. GCT is a freely-distributable coverage tool for C programs, based on
  288. the GNU C compiler.  Coverage tools measure how thoroughly a test
  289. suite exercises a program.  I tested without a coverage tool for
  290. years, but I've used GCT and its predecessor for about three years now.
  291. I'll never go back to testing without coverage.
  292.  
  293. GCT provides coverage measures of interest to both practitioners and
  294. testing researchers:
  295.  
  296. (1) branch coverage.  Do the tests force every branch in both
  297. directions?  Has every case in a switch been taken?
  298.  
  299. (2)  multiple-condition coverage.  In a statement like
  300.         if (A ||  B)
  301. has A been both true and false?  Has B?  Multiple-condition coverage
  302. is stronger than branch coverage.
  303.  
  304. (3) loop coverage.  Has every loop been skipped?  Has every loop been
  305. iterated exactly once?  More than once?  Tests to satisfy loop
  306. coverage can force the detection of some bugs that branch coverage
  307. might miss.
  308.  
  309. (4) relational operator coverage.  Do tests probe for off-by-one
  310. errors?
  311.  
  312. (5) routine and call coverage.  Has every routine been entered?  Has
  313. every function call in a routine been exercised?  These two measures
  314. are weaker than the above, but they are useful for getting a general
  315. picture of the coverage of system testing.
  316.  
  317. (6) race coverage.  This special-purpose measure is useful for
  318. evaluating stress tests of multi-threaded systems, tests designed to
  319. find locking and concurrency problems.
  320.  
  321. (7) weak mutation coverage.  This is a type of coverage of most
  322. interest to researchers.
  323.  
  324. GCT has been used in large C development projects.  It is
  325. "industrial-strength".
  326.  
  327. Platforms
  328.  
  329. GCT runs on many versions of UNIX; porting it to new ones is usually
  330. simple.  An earlier version ran on HP/Apollo's Aegis, so the current
  331. version should be easy to port.
  332.  
  333. Mechanism
  334.  
  335. GCT takes C source code and adds instrumentation.  This new C source
  336. is then compiled as usual.  This allows you to use your favorite C
  337. compiler. GCT is designed to work with existing makefiles (or other
  338. system build mechanisms).  For example, instrumenting the entire
  339. System V Release 4 UNIX kernel requires changes to only the top-level
  340. makefile.
  341.  
  342. As the compiled program runs, it updates an internal log.  The log is
  343. written on exit (or, in the case of an unending program like the UNIX
  344. kernel, extracted from the running program).  Other tools produce
  345. coverage reports (detailed or summary) from the log.
  346.  
  347. Instrumentation is time-efficient, a few instructions per
  348. instrumentation point.
  349.  
  350. Retrieving GCT
  351.  
  352. GCT is available via anonymous FTP from cs.uiuc.edu.  Log in as user
  353. "anonymous", and give your email address as the password.  The file
  354. /pub/testing/GCT.README describes the GCT distribution.
  355.  
  356. GCT and its documentation are also available on 8mm and QIC tapes for
  357. $150.
  358.  
  359. After retrieving and installing GCT, be sure to run the tutorial.  See
  360. the document 'A Tutorial Introduction to GCT'.
  361.  
  362. Support and Training
  363.  
  364. While GCT is free, the services you expect for a commercial product
  365. are available for a price.  Contact me for information about support
  366. and training, or for information about other services I offer.
  367. Informal GCT support is available through the GCT mailing list; send
  368. mail to gct-request@ernie.cs.uiuc.edu to join it.
  369.  
  370. Brian Marick
  371. Testing Foundations
  372. 809 Balboa, Champaign, IL  61820
  373. (217) 351-7228
  374. marick@cs.uiuc.edu
  375. ----------------------------------------------------------------------------
  376.  
  377. From: Brian Marick <uunet!cs.uiuc.edu!marick>
  378.  
  379. This may also be of interest.  It describes what I do when I test my
  380. own software, a smallish addition - maybe 10,000 lines - embedded
  381. inside a much larger C compiler.
  382.  
  383.                    A CASE STUDY IN COVERAGE TESTING
  384.                              Brian Marick
  385.                          Testing Foundations
  386.  
  387. Abstract
  388.  
  389. I used a C coverage tool to measure the quality of its own test suite.
  390. I wrote new tests to improve the coverage of a 2600-line segment of
  391. the tool.  I then reused and extended those tests for the next
  392. release, which included a complete rewrite of that segment.  The
  393. experience reinforced my beliefs about coverage-based testing:
  394.  
  395. 1.  A thorough test suite should achieve nearly 100% feasible coverage.
  396. 2.  Adding tests for additional coverage can be cheap and effective.
  397. 3.  To be effective, testing should not be a blind attempt to achieve
  398.     coverage.  Instead, use coverage as a signal that points to weakly-tested
  399.     parts of the specification.
  400. 4.  In addition to suggesting new tests, coverage also tells you when existing
  401.     tests aren't doing what you think, a common problem.
  402. 5.  Coverage beyond branch coverage is worthwhile.
  403. 6.  Even with thorough testing, expect documentation, directed
  404.     inspections, beta testing, and customers to find bugs, especially design
  405.     and specification bugs.
  406.  
  407. The Generic Coverage Tool
  408.  
  409. GCT is a freeware coverage tool for C programs, based on the GNU C
  410. compiler.   It measures these kinds of coverage:
  411. - branch coverage (every branch must be taken in both directions)
  412. - multi-condition coverage (in 'if (a && b)', both subexpressions must
  413.   evaluate to true and false).
  414. - loop coverage (require loop not to be taken, to be traversed exactly once,
  415.   and traversed more than once)
  416. - relational coverage (require tests for off-by-one errors)
  417. - routine entry and call point coverage.
  418. - race coverage (extension to routine coverage for multiprocessing)
  419. - weak mutation coverage (a research technique)
  420.  
  421. (For more, see [Marick92].)
  422.  
  423. The tool comes with a large regression test suite, developed in
  424. parallel with the code, using a "design a little, test a little, code
  425. a little" approach, much like that described in [Rettig91].  About
  426. half the original development time was spent in test construction (with, I
  427. believe, a corresponding reduction in the amount of frantic debugging
  428. when problems were found by users - though of course there was some of
  429. that).  Most of the tests are targetted to particular subsystems, but
  430. they are not unit tests.  That is, the tests invoke GCT and deduce
  431. subsystem correctness by examining GCT's output.  Only a few routines
  432. are tested in isolation using stubs - that's usually too expensive.  When
  433. needed, test support code was built into GCT to expose its internal
  434. state.
  435.  
  436. In early releases, I had not measured the coverage of GCT's own test
  437. suite.  However, in planning the 1.3 release, I decided to replace the
  438. instrumentation module with two parallel versions.  The original
  439. module was to be retained for researchers; commercial users would use
  440. a different module that wouldn't provide weak mutation coverage but
  441. would be superior in other ways.  Before redoing the implementation, I
  442. wanted the test suite to be solid, because I knew a good test suite
  443. would save implementation time.
  444.  
  445. Measuring Coverage
  446.  
  447. I used branch, loop, multi-condition, and relational coverage.  I'm
  448. not convinced weak mutation coverage is cost-effective.  Here were my
  449. initial results for the 2617 lines of code I planned to replace.
  450. (The count excludes comments, blank lines, and lines including only
  451. braces.)
  452.  
  453. BINARY BRANCH INSTRUMENTATION (402 conditions total)
  454. 47 (11.69%) not satisfied.
  455. 355 (88.31%) fully satisfied.
  456.  
  457. SWITCH INSTRUMENTATION (90 conditions total)
  458. 14 (15.56%) not satisfied.
  459. 76 (84.44%) fully satisfied.
  460.  
  461. LOOP INSTRUMENTATION (24 conditions total)
  462. 5 (20.83%) not satisfied.
  463. 19 (79.17%) fully satisfied.
  464.  
  465. MULTIPLE CONDITION INSTRUMENTATION (390 conditions total)
  466. 56 (14.36%) not satisfied.
  467. 334 (85.64%) fully satisfied.
  468.  
  469. OPERATOR INSTRUMENTATION (45 conditions total)  ;; This is relational coverage
  470. 7 (15.56%) not satisfied.
  471. 38 (84.44%) fully satisfied.
  472.  
  473. SUMMARY OF ALL CONDITION TYPES (951 total)
  474. 129 (13.56%) not satisfied.
  475. 822 (86.44%) fully satisfied.
  476. These coverage numbers are consistent with what I've seen using black
  477. box unit testing combined with judicious peeks into the code.  (See
  478. [Marick91].)  I do not target coverage in my test design; it's more
  479. important to concentrate on the specification, since many important
  480. faults will be due to omitted code [Glass81].
  481.  
  482. When the uncovered conditions were examined more closely (which took
  483. less than an hour), it was clear that the tests were more thorough
  484. than appears from the above.  The 129 uncovered conditions broke down
  485. as follows:
  486.  
  487. 28 were impossible to satisfy (sanity checks, loops with fixed bounds
  488. can't be executed 0 times, and so on).
  489.  
  490. 46 were support code for a feature that was never implemented (because
  491. it turned out not to be worthwhile); these were also impossible to
  492. exercise.
  493.  
  494. 17 were from temporary code, inserted to work around excessive stack
  495. growth on embedded systems.  It was always expected to be removed, so
  496. was not tested.
  497.  
  498. 24 were due to a major feature, added late, that had never had
  499. regression tests written for it.
  500.  
  501. 14 conditions corresponded to 10 untested minor features.
  502.  
  503. All in all, the test suite had been pleasingly thorough.
  504.  
  505. New Tests Prior to the Rewrite
  506.  
  507. I spent 4 hours adding tests for the untested major feature.  I was
  508. careful not to concentrate on merely achieving coverage, but rather on
  509. designing tests based on what the program was supposed to do.  Coverage
  510. is seductive - like all metrics, it is only an approximation of what's
  511. important.  When "making the numbers" becomes the prime focus,
  512. they're often achieved at the expense of what they're supposed to measure.
  513.  
  514. This strategy paid off.  I found a bug in handling switches within
  515. macros.  A test designed solely to achieve coverage would likely have
  516. missed the bug.  (That is, the uncovered conditions could have
  517. been satisfied by an easy - but inadequate - test.)
  518.  
  519. There was another benefit.  Experience writing these tests clarified
  520. design changes I'd planned to make anyway.  Writing tests often has
  521. this effect.  That's why it's good to design tests (and write user
  522. documentation) as early as possible.
  523.  
  524. I spent two more hours testing the minor features.  I did not write
  525. tests for features that were only relevant to weak mutation.
  526.  
  527. Branch coverage discovered one pseudo-bug: dead code.  A particular
  528. special case check was incorrect.  It was testing a variable against
  529. the wrong constant.  This check could never be true, so the special
  530. case code was never executed.  However, the special case code turned
  531. out to have the same effect as the normal code, so it was removed.
  532. (This fault was most likely introduced during earlier maintenance.)
  533.  
  534. At this point, tests written because of multi-condition, loop, and relational
  535. coverage revealed no bugs.  My intuitive feel was that the tests
  536. were not useless - they checked situations that might well have led to
  537. failures, but didn't.
  538.  
  539. I reran the complete test suite overnight and rechecked coverage the
  540. next day.  One test error was discovered; a typo caused the test to
  541. miss checking what it was designed to test.  Rechecking took 1/2 hour.
  542.  
  543. Reusing the Test Suite
  544.  
  545. The rewrite of the instrumentation module was primarily a
  546. re-implementation of the same specification.  All of the test suite
  547. could be reused, and there were few new features that required new
  548. tests.  (I did go ahead and write tests for the weak mutation features
  549. I'd earlier ignored.)  About 20% of the development time was spent on
  550. the test suite (including new tests, revisions to existing tests, and
  551. a major reorganization of the suite's directory structure and
  552. controlling scripts).
  553.  
  554. The regression test suite found minor coding errors; they always do,
  555. in a major revision like this.  It found no design flaws.  Rewriting
  556. the internal documentation (code headers) did.  (After I finish code,
  557. I go back and revise all the internal documentation.  The shift in
  558. focus from producing code to explaining it to an imaginary audience
  559. invariably suggests improvements, usually simplifications.  Since I'm
  560. a one-man company, I don't have the luxury of team code reads.)
  561.  
  562. The revised test suite achieved 96.47% coverage.  Of 37 unsatisfied
  563. conditions:
  564.  
  565. 27 were impossible to satisfy.
  566. 2 were impossible to test portably (GNU C extensions).
  567. 2 were real (though minor) omissions.
  568. 1 was due to a test that had been misplaced in the reorganization.
  569. 5 were IF tests that had been made redundant by the rewrite. They were removed.
  570.  
  571. It took an hour to analyse the coverage results and write the needed
  572. tests.  They found no bugs.  Measuring the coverage for the augmented
  573. test suite revealed that I'd neglected to add one test file to the
  574. test suite's controlling script.
  575.  
  576. Other Tests
  577.  
  578. The 1.3 release also had other features, which were duly tested.  For
  579. one feature, relational operator coverage forced the discovery of a
  580. bug.  A coverage condition was impossible to satisfy because the code
  581. was wrong.  I've found that loop, multi-condition, and relational
  582. operator coverage are cheap to satisfy, once you've satisfied branch
  583. coverage.  This bug was severe enough that it alone justified the time
  584. I spent on coverage beyond branch.
  585.  
  586. Impossible conditions due to bugs happen often enough that I believe
  587. goals like "85% coverage" are a mistake.  The problem with such goals
  588. is that you don't look at the remaining 15%, deciding, without
  589. evidence, that they're either impossible or not worth satisfying. It's
  590. better - and not much more expensive - to decide each case on its
  591. merits.
  592.  
  593. What Testing Missed
  594.  
  595. Three bugs were discovered during beta testing, one after release (so
  596. far).  I'll go into some detail, because they nicely illustrate the
  597. types of bugs that testing tends to miss.
  598.  
  599. The first bug was a high level design omission.  No testing technique
  600. would force its discovery. ("Make sure you instrument routines with a
  601. variable number of arguments, compile them with the GNU C
  602. compiler, and do that on a machine where GCC uses its own copy of
  603. <varargs.h>.")  This is exactly the sort of bug that beta testing is
  604. all about.
  605.  
  606. Fixing the bug required moderately extensive changes and additions,
  607. always dangerous just before a release.  Sure enough, the fix
  608. contained two bugs of its own (perhaps because I rushed to meet a
  609. self-imposed deadline).
  610.  
  611. - The first was a minor design omission.  Some helpful code was added
  612. to warn GCC users iff they need to worry about <varargs.h>. This code
  613. made an assumption that was violated in one case.  Coverage would not
  614. force a test to detect this bug, which is of the sort that's fixed by
  615. changing
  616.  
  617.         if (A && B)
  618.  
  619. to
  620.  
  621.         if (A && B && C)
  622.  
  623. It would have been nice if GCT would have told me that "condition C,
  624. which you should have but don't, was never false", but this is more
  625. than a coverage tool can reasonably be expected to do.  I found the
  626. bug by augmenting the acceptance test suite, which consists of
  627. instrumenting and running several large "real" programs.  (GCT's test
  628. suite contains mostly small programs.)  Instrumenting a new real
  629. program did the trick.
  630.  
  631. - As part of the original fix, a particular manifest constant had to
  632. be replaced by another in some cases.  I missed one of the cases.  The
  633. result was that a few too few bytes of memory were allocated for a
  634. buffer and later code could write past the end.  Existing tests did
  635. indeed force the bytes to be written past the end; however, this
  636. didn't cause a failure on my development machine (because the memory
  637. allocator rounds up).  It did cause a failure on a different machine.
  638. Memory allocation bugs, like this one and the next, often slip past
  639. testing.
  640.  
  641. The final bug was a classic: freeing memory that was not supposed to
  642. be freed.  None of the tests caused the memory to be reused after
  643. freeing, but a real program did.  I can envision an implementable type
  644. of coverage that would force detection of this bug, but it seems as
  645. though a code-read checklist ought to be better.  I use such a
  646. checklist, but I still missed the bug.
  647.  
  648.  
  649. References
  650.  
  651. [Rettig91]      Marc Rettig, "Practical Programmer:  Testing Made
  652.         Palatable", CACM, May, 1991.
  653.  
  654. [Marick91]      Brian Marick, "Experience with the Cost of Different
  655.         Coverage Goals for Testing", Pacific Northwest Software Quality
  656.         Conference, 1991.
  657.  
  658. [Marick92]      Brian Marick, "A Tutorial Introduction to GCT",
  659.         "Generic Coverage Tool (GCT) User's Guide", "GCT Troubleshooting",
  660.         "Using Race Coverage with GCT", and "Using Weak Mutation Coverage with G
  661. CT",
  662.         Testing Foundations, 1992.
  663.  
  664. [Glass81]       Robert L. Glass. "Persistent Software Errors", Transactions
  665.         on Software Engineering", vol. SE-7, No. 2, pp. 162-168,
  666.         March, 1981.
  667.  
  668. Brian Marick, marick@cs.uiuc.edu, uiucdcs!marick
  669. Testing Foundations:  Consulting, Training, Tools.
  670.  
  671. -------------------------------------------------------------------------
  672. From: uunet!veritas.com!joshua (Joshua Levy)
  673.  
  674. You may be interested in ViSTA, a product made by my company.
  675. You can send email to our sales people at vsales@veritas.com, or
  676. call our east coast sales person, Jerry DeBaun, at 508-624-7758.
  677.  
  678. ViSTA is a tool for gathering coverage metrics on your code as you test it.
  679. It can tell you how much of your code is being tested by your test suite.
  680. This can be valuable in determining how much testing still needs to be done.
  681. ViSTA also can tell you exactly which pieces of code have been tested, so
  682. you can write code to specifically test those parts which are not currently
  683. tested.
  684.  
  685. We have found that using ViSTA significantly reduces the amount of time
  686. it takes to test code.  Without coverage data, most test suites repeatedly
  687. test the same code over and over again, wasting most of their time (both
  688. development and execution).  The data ViSTA provides can direct testing
  689. in a way which greatly reduces this waste.
  690.  
  691. ViSTA works on C code (Application level or Kernel level) on these platforms:
  692. SunOS 4.1.x, AIX 3.x, HP 700s and 800s.  We also support several "custom"
  693. ports including SVR3, SVR4, SCO UNIX, Pyramid, etc.  Availability for
  694. these ports varies.
  695.  
  696. Please give me a call or send email if you have any questions, or if
  697. I have not clearly explained what ViSTA does.  Thanks.
  698.  
  699. Joshua Levy  (joshua@veritas.com)   408-727-1222x253 or 800-if-vista
  700.  
  701. -------------------------------------------------------------------------
  702. From: uunet!veritas.com!paula (Paula Phelan)
  703.  
  704. Thanks for your interest in ViSTA.  I will send along marketing literature
  705. this afternoon.  If you like what you see give Jerry DeBaun a call
  706. at 508-624-7758 he is the Regional Sales Manager in your area.
  707.  
  708. Paula
  709.  
  710.  
  711.  
  712.  
  713. HIGHLIGHTS
  714.         Code coverage testing tool for developers and testers
  715.         Static and Dynamic Analysis of new or existing code
  716.         McCabe and Halstead Metrics
  717.         Error Seeding (to test testcase quality)
  718.         Selective Instrumentation
  719.         Works on multi-threaded code
  720.         Multi-processor development support
  721.         Application simulation of: OS calls, I/O errors, hardware states
  722.         Kernel simulation of: Process credentials, DKI/DDI, I/O errors
  723.         Ability to customize simulations
  724.  
  725. OVERVIEW DESCRIPTION of VERITAS ViSTA
  726.  
  727. VERITAS Vista provides metric-based testing tools for application and
  728. kernel code.  The tools inform developers, testers, and managers about test
  729. coverage and code maintainability.
  730.  
  731. ViSTA reports on source code static metrics; estimates the number of test cases
  732. needed, determines the complexity of the code, and estimates the number of
  733. errors. ViSTA dynamic metrics identifies code segments missed by existing test
  734. cases and highlights redundant coverage.  All metric data can be displayed
  735. graphically for at-a-glance comprehension.
  736.  
  737. Error seeding is available to test the quality of test cases by verifying if
  738. they detect the errors they're intended to find.
  739.  
  740. ViSTA utilities can simulate event-driven conditions to improve code coverage.
  741. This technology allows for testing hard to reach code or where replicating
  742. the physical I/O resource would be prohibitively expensive.
  743.  
  744.  
  745. DESCRIPTION of VERITAS ViSTA Modules
  746.  
  747. VistaTEST
  748. The foundation of VERITAS ViSTA is VistaTEST.  This facility provides the
  749. basic capabilities for code coverage, complexity metrics, error seeding and
  750. report generation.
  751.  
  752. VistaTEST supplies development teams with the basic tools to immediately
  753. improve the detection and elimination of latent defects, increases the
  754. insight and understanding of existing code, and reduces the cost of software
  755. testing.
  756.  
  757. VistaTEST defines what needs to be tested, estimates the cost of testing and
  758. the level of effort required.  An advanced preprocessor that works with
  759. ANSI C or K&R C is provided, and is platform independent.  VistaTEST also
  760. provides coverage measurements by determining what sections of the code are
  761. actually exercised by testing programs.  It provides coverage of function
  762. entry/exits, segments, conditionals, basic blocks, paths and interface
  763. behaviors.  Metrics are collected to determine the complexity of the code,
  764. level of coverage with existing tests and the number of tests needed for
  765. adequate coverage.  Run-time monitors support coverage statistics for library,
  766. application, daemon, and kernel code.
  767.  
  768. VistaSIM
  769. VistaSIM offers state of the art software validation for application and kerneldevelopers, by providing error handling logic, simulating behaviors at
  770. interface points and creating a more complete test scenario.  It simulates all
  771. external behaviors at function interface proints including function return
  772. values, argument return values, and global variable values.  The UNIX
  773. operating system calls are included and other simulation libraries may be
  774. extended by the user.
  775.  
  776. ORDERING INFORMATION
  777. Contact VERITAS sales at 408-727-1222 or vsales@veritas.com, VistaTEST list
  778. price $1800.  Quantity pricing is available on request.
  779.  
  780. TRADEMARK ATTRIBUTES
  781. VERITAS ViSTA, VistaTEST, VistaSIM and VistaKERNEL are trademarks of VERITAS
  782. Software Corporation.
  783.  
  784. --
  785. Paula Phelan                                                    VERITAS Software
  786. 4800 Great America Parkway #420   Santa Clara, CA 95054     +1 408-727-1222 x241
  787. paula@veritas.com                               ...{apple,pyramid}!veritas!paula
  788.  
  789. ---------------------------------------------------------------------------
  790.  
  791.