๏ฟฝ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโ โ โ โ โ โโ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โโ โ โ โ โ โ โ โ Value-based view โข helps to decide trade-offs during development โ cost vs. reliability โ cost vs. functionality โข cost to consumer is affected by scale โ high volume products have a higher perceived value โข value is defined by โ potential savings/productivity enhancements โ profit opportunities โโฃโข โโโ
๏ฟฝ โ โ โก โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โ โ ๏ฟฝ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โ โก โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โก โ โ โ โโ โ โ โโ โ โ โ โ โโ โ โ โ โ โ โ โ โ โโ Problems with Qualities โข qualities are at odds with one another โ always a compromise โโโ โโโ โโโ โโโ โข difficulty in trying to measure qualities e.g., accuracy, usability โข what does quality really mean? โโฃโข โโโ
๏ฟฝ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โโ โ โ โ โ โ โ Proposed solution 1: Focus on Product โข most dimensions of quality are measured after the fact โข need to identify actions that can embed needed qualities in the products, up front โข implementation quality model: identify what the programmer can do to ensure quality โ link these actions to high level qualities โโคโฃ โโโ
โ ๏ฟฝ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โ โโ โ โ โ โ Proposed Solution 1 (contโd) โข requirements quality model: all requirement statements must be measurable โข design quality model: define qualities for design, identify characteristics of design that would embed those qualities โโคโฃ โโโ
โ โ โ โ ๏ฟฝ โ โ โ โ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โโ โ โ โ โ Proposed solution 2: Focus on Process โข integrate quality decisions into the design process, e.g.: โ by using quality checklists during inspection, design โ by determining testing criteria up front โ by following a documented design process โโคโฃ โโโ
โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โโ โ โ โ โ Qualities Discernable at Runtime โข performance โข security โข availablity โข functionality โข usability โโคโฃ โโโ
โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โโ โ โ โ โ โ โ Qualities Not Discernable at Runtime โข modifiability โข portability โข reusability โข testability โ ease with which software can be made to demonstrate its faults through execution based testing โ related to architectural documentation, separation of concern, information hiding, incremental development โโคโฃ โโโ
๏ฟฝ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโ โ โ โ โ โ ๏ฟฝ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ โก โ โ โ ๏ฟฝ โโ โ โ โ โ โ โ Business Qualities โข time to market โข cost โข projected lifetime of system โข targeted market โข integration with existing legacy systems โโฃโข โโโ
๏ฟฝ โ โ ๏ฟฝ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโ โ โ โ โ โ ๏ฟฝ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ ๏ฟฝ โ โ โโ โ โ โ โ What's Ahead Remainder of material about quality focuses on two topics related to software quality: โ Testing: finding defects by executing software and examining results (and then fixing the defects) โ Inspection: a formal way of analyzing software and other documents โโฃโข โโโ
๏ฟฝ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ ๏ฟฝ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ ๏ฟฝ โโ โ โ โ โ โ What is Software Inspection? โข Formal process to statically analyze a software product and record metrics related to that product. โข Differs from informal "walk-throughs" or "reviews": โ formal process โ products inspected at greater level of detail โ metrics โโฃโข โโโ
๏ฟฝ โก โ โ โ โกโ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ ๏ฟฝ โ โ โ โ โ โ โ โ โ โ โก โ โ โ โ โ โก โ โ โ โ โโ โ โ โก โ ๏ฟฝ โ โ โ โ โ โ ๏ฟฝ โโ โ โ โ โ โ โ โ โ โ โ โก โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โโ โ โ โ โโ โ โ โ โ โ โ โ โ โ IEEE Definition "...a formal evaluation technique in which software requirements, design, or code are examined in detail by a person or group other than the author to detect faults, violations of development standards, and other problems..." โโโ โโโ โโโ โโฃโข โโโ
๏ฟฝโ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ ๏ฟฝ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โก โ โ โ โ โ โโ ๏ฟฝ โ โ โ โ History โข Traditional meaning of inspection: โ Inspecting the product of a manufacturing process โ Physical product, evaluate by looking, manipulating โ Often put through rigorous tests, keep metrics โข Michael Fagan at IBM: โ used similar processes to inspect software (code) โ landmark paper in 1976 โ often called "Fagan Inspections" โ Inspection process has been extended & refined since, ongoing research โโฃโข โโโ
๏ฟฝโ โฎ โฐ โน โฆ โช โฎ โด โณ โช โฒ โฆ โฑ โฎ โฎ โญ โซ โฐ โฎโฏ โช โซ โช โฅ โฅโฆ โฑ โฆ โ โฎ โฒ โฎ โณ โช โง โฅ โฐ โฅโฆ โฑ โญ โช โฒ โฐ โณ โช โฅโฆ โง โช โฎ โฒ โณ โช โ โค ๏ฟฝ โ โ โ โ โ ๏ฟฝ โโ โ โ โ โ โ โ โ โ โ โ โก โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โโ โ โ โ โโ โ โ โ โ โ โ โ โ โ What Gets Inspected? โข Inspection process initially used to inspect software (code) โข Extended to include all documents: โงโฉโ โฌโฉโญ โดโธโท โซโถโต โฒโปโบ โนโฝโผ โข Above includes diagrams, prose, pseudo-code, etc. โข Some other industries have adopted Inspection for design documents, drawings, etc. โโฃโข โโโ
๏ฟฝโ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโ โ โ โ โ ๏ฟฝโ ๏ฟฝ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ ๏ฟฝ ๏ฟฝโ โ โ โ โ โ โ โ Inspection Versus Testing (1) โข AT&T classifies inspection as a form of testing โข In CISC 323, we use the term "testing" to mean dynamic testing: executing software to find faults โข inspection does not replace dynamic testing โข software process should include both inspection and testing โโฃโข โโโ
๏ฟฝ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโ โ โ โ โ ๏ฟฝโ ๏ฟฝ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ โก โ โ ๏ฟฝ ๏ฟฝโ โ โ โ โ โ โ โ Inspection Versus Testing (2) โข difficult to inspect for qualities such as performance, timing, load โข inspection can be applied earlier than testing โข inspection can be applied to any software product, not just code โโฃโข โโโ
๏ฟฝโ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโ โ โ โ โ ๏ฟฝโ ๏ฟฝ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ ๏ฟฝ โ โ โ ๏ฟฝโ โ โ โ โ Defects vs. Faults โข Inspection finds defects: problems in software โข Testing finds faults: incorrect behavior โข When you find a fault by testing: โ must debug to trace the fault to a defect in the code โข Often more cost-effective to find defaults via Inspection โโฃโข โโโ
๏ฟฝ โ โ โ โ โก โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โโ โ โ โ โ โ ๏ฟฝ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โก โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โก โ โ โ โ โ โ โ ๏ฟฝโ ๏ฟฝ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โโ โโก โ โโ โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โ โ ๏ฟฝ โ ๏ฟฝโ โ โ โโ โ โ โ โ ๏ฟฝ Analysis Tools โข static analysis tools can find some types of defects โ compilers find undeclared variables, syntax errors โ other static analysis tools may check for: โโโ โโโ โข should inspect for things tools canโt find โโฃโข โโโ
๏ฟฝ โด โฉ โฏ โฉ โฆ โ โฑ โฉ โฒ โซ โฒโณ โด โง โญ โท โฌ โฏ โญ โบ โป โผ โฝ โง โญ โฌ โด โพ โฐ โฐ โฉ โฆ โฐ โฌ โซ โก โ โ โ โ โ โก โ โค โ โ โก โ โ โ โ โญโฎ โ โซโฌ โฆโง โค โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โฆ โฌ โ โน โ โฟ โฆ โฌ โ โ โฉ โฆ โฐ โฐ โญ โญ โซ โฟ โ โซ โง โน โฐ โ โฝ โฉ โฏ โธ โฉ โ โฉ โ โฝ โฐ โฉ โฐ โฉ โฏ โฉ โฆ โ โป โฟ โ โซ โซ โฉ โฟ โธ โ โน โธ โง โฏ โป โฟ โ โฉ โด โด โฉ โ โฌ โญ โพ โ โ โ โค โ โ โ โโ โ โ โ โโ โ โ โ โ ๏ฟฝโ ๏ฟฝ โ โ โ โ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ ๏ฟฝ ๏ฟฝโ โ โ โ โ โก โ โฐ โ โ โ โ โก โ โ โ โค โ โ โ โก โ โ โ โ โ โก โ โก โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โค โ โก โ โข to be classified as โinspectionโ, metrics must be kept โธโถโน Inspection Metrics โธโถโน โโฃโข โธโถโน โ โชโฉ โตโถโฌ โธโถโน โโโ โธโถโน โ โชโฉ โ โชโฉ โข may also record โ โชโฉ โ โชโฉ โข record: โ โชโพ โ โชโฉ โ โฃโฅ
๏ฟฝ โซ โน โฉ โด โ โฆ โฌ โฐ โณ โฐ โง โฌ โฆ โณ โน โซ โธ โฟ โฉ โ โ โค โฌ โ โฉ โณ โซ โ โฟ โณ โน โธ โธ โ โฆ โฉ โพ โฟ โณ โน โฌ โฐ โซ โฒ โฌ โฉ โพ โฟ โฉ โด โธ โ โฏ โฉ โ โซ โง โ โน โฉ โ โญ โฉ โน โฌ โฟ โง โฉ โธ โ โธ โ โธ โ โฆ โ โน โน โฉ โญ โฉ โฏ โฏ โธ โฐ โฆ โป โป โฌ โฉ โฆ โฌ โญ โน โฉ โด โพ โ โฟ โฉ โ โฉ โฐ โฟ โ โน โฉ โฟ โป โฉ โซ โฟ โฉ โฆ โฌ โญ โพ โฟ โฉ โน โฉ โง โฝ โฆ โง โ โ โง โ โด โ โต โฉ โฟ โน โธ โ โน โฉ โพ โฟ โด โฉ โธ โ โฎ โฏ โธ โ โฟ โ โพ โฆ โฌ โซ โญ โพ โด โธ โ โฟ โฉ โซ โ โ โฟ โป โซ โ โฟ โฌ โซ โน โธ โพ โฆ โซ โง โฟ โ โฆ โฉ โฏ โฉ โฐ โ โ โฉ โฌ โ โป ๏ฟฝ ๏ฟฝโ โ โ โ โพ โญ โโ โฌ โ โฉ โธ โ โญ โฉ โพ โญ โฉ โ โฐ โฌ โฆ โฏ โฌ โฉ โน โธ โ โ โธ โก โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ ๏ฟฝโ โ โ โ โ โ โ โ ๏ฟฝ โน โด โ โฅโฆ โฆ โฉ โฏ โฉ โฐ โฏ โฌ โง โฒ โฟ โซ โฒ โฉ โค โฟ โฉ โซ โป โง โ โฏ โฟ โฌ โ โฟ โฎ โ โง โฆ โช โณ โน โธ โฌ โ โฆ โฉ โพ โฟ โฎ โฐ โ โน โ โ โฟ โ โฉ โ โน โฉ โฏ โฉ โฐ โฏ โฌ โซ โฏ โง โ โน โฉ โฆ โญ โฉ โพ โฟ โฆ โฌ โฐ โฉ โฏ โฏ โธ โฉ โญ โง โ โฐ โน โ โธโถโน โ โชโฉ โธโถโน โ โชโฉ โ โชโพ โธโถโน โธโถโน โฉ โถโน โโฃโข โ โชโฉ Use of Metrics โข Data collected can tell you: โธโถโน โโโ โข Data can be used to: โธโถโน โธโถโน โ โชโฉ
๏ฟฝ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโ โ โ โ โ ๏ฟฝโ ๏ฟฝ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โ โ โ ๏ฟฝโ ๏ฟฝ Inspection Process from Software Inspection , Tom Gilb & Dorothy Graham โโฃโข โโโ
๏ฟฝ โด โธ โน โซ โ โฝ โฉ โพ โญ โฌ โฐ โ โฆ โ โป โง โฎ โง โฑ โญ โฌ โฝ โ โ โฉ โฎ โฐ โ โ โฆ โน โธ โ โ โบ โ โฟ โป โบ โน โฌ โธ โฆโง โฉ โธ โฏ โธ โ โญ ๏ฟฝ โพ โน โง โฐ โน โง โท โซ โน โธ โง โฐ โฉ โญ โฉ โด โธ โ โฟ โณ โณ โฐ โ โป โฆ โฝ โน โธ โฆโง โ โ โน โฌ โผ โ โฉ โซ โฉ โฌ โฆ โ โฐ โฌ โญ โพ โ โฉ โซ โ โง โ โฉ โญ โ โฝ โ โฝ โง โญ โ โ โญ โฌ โฟ โซ โป โญ โฉ โฐ โง โฉ โซ โ โ โฟ โน โฌ โ โญ โฌ โฉ โญ โ โ โฌ โฆ โฎ โง โฐ โฆ โฉ โฉ ๏ฟฝ โ โ โ โ โโ โ โ โ โโ โ โ โ โ ๏ฟฝโ โป โ โฌ โญ โซ โง โน โฉ โฟ โฌ โด โง โน โฟ โซ โฉ โ โ โฟ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โ โ โ ๏ฟฝโ ๏ฟฝ โ โ โ โ โ โ โ โฟ โง โพ โ โธ โฆ โฉ โพ โฟ โฉ โง โ โฝ โฐ โ โ โฉ โฝ โง โ โป โฐ โญ โ โฌ โฆ โฎ โง โ โญ โ โ โด โฑ โซ โง โฟ โฌ โฟ โฌ โซ โป โฟ โฟ โฉ โฆ โญ โฉ โพ โน โฌ โธ โ โฆ โฐ โดโฌ โ โด โ โฉ โฉ โฟ โง โญ People Involved in Inspection โข Inspection is a team process: ideally 2-6 people โตโถโฌ โธ โโ โโฃโข โธโถโน โธโถโน โโโ โธโถโน โฉ โถโน โข checkers (inspectors) โข Inspection Leader: โธโถโน โธโถโน โธโถโน โ โชโฉ โธ โโ โ โชโฉ
๏ฟฝ โซ โญ โญ โฌ โญ โฟ โป โฉ โฒ โฒโณ โซ โฟ โฌ โ โญ โฆ โฉ โฆ โฌ โฉ โพ โฉ โซ โ โพ โธ โ โฉ โป โฉ โฒ โฒโณ โฎ โ โฌ โฌ โด โง โน โฎ โ โฐ โฐ โฆ โฉ โน โ โ โผ โง โฟ โฟ โพ โฆ โฐ โ โฌ โญ โฟ โ โธ โด โฉ โฌ โป โฌ โพ โฉ โฟ โน โฌ โ โฆ โฌ โด โธ โฎ โ โฉ โฆ โ โฉ โง โน โ โฌ โด โญ โ โ โ โ โ โ โ โ โ ๏ฟฝโ โ โ โ โ โ โ โโ โ ๏ฟฝ โ โโ โก โ โ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โฟ โฏ โญ โฌ โฉ โญ โ โฉ โ โญ โธ โน โซ โญ โฌ โป โ โง โฌ โฏ โฉ โ โฏ โ โ ๏ฟฝโ ๏ฟฝ โฉ โป โ โง โฉ โฏ โฌ โญ Entry โข entry criteria set up for products to be inspected โข a lot of controversy about when to inspect code โ โชโฉ โ โชโฉ โข if entry criteria not met, product not inspected โธโถโน โข inspections are expensive โ โชโฉ โธโถโน โข author offers up product for inspection โข leaders decides if it's ready -- quick examination โโฃโข โโโ
๏ฟฝ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโ โ โ โ โ ๏ฟฝโ ๏ฟฝ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ ๏ฟฝโ โ โ ๏ฟฝ โ โ โ โ Kickoff โข initial meeting for all participants โข organized by leader โข familiarize everyone involved with task at hand โข define everyoneโs roles โข hand out materials needed โข deal with general questions โข set goals โข discuss overall plan, timetable โข long documents divided into "chunks": separate inspection & logging for each chunk โโฃโข โโโ
๏ฟฝ โฆ โฅ โฌ โฎ โง โฑ โงโฌ โซ โง โช โง โฉ โงโ โฆ โฅ โ โ โ โ โ โฑ โฎ โ โฉ โฎ โง โญ โงโฌ โซ โง โฆ โช โงโ โช โฆ โฅ โง โฑ โดโฐ โฐ โญ โฌ โฒ โ โ โฌ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โก โ โ โ โ โ โโ โ โ โ โโข โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โ Individual Checking (1) โข each checker works alone using documents handed out in kick-off meeting โข aims to find maximum number of unique major potential defects โข mainly by looking for discrepancies between source documents and products being inspected, i.e.: โญโฏโฎ โญโฏโฐ โชโณโฒ โถโธโท โญโฏโฎ โญโฏโฐ โญโฏโต โโคโฃ โโโ
๏ฟฝ โ โฌ โ โต โฐ โฎ โฎ โช โถ โช โ โช โซ โต โท โด โญ โฅ โฐ โญ โฐ โช โง โฅ โฑ โง โฎ โด โฆ โต โท โญ โช โฐ โฌ โ โถ โฐ โด โต โฎ โ โฅ โ โช โฌ โญ โงโฌ โญ โ โฎ โฌ โฉ โฒ โฒ โง โฎ โญ โช โฐ โฐ โฐ โฎ โง โช โ โถ โง โฑ โง โ โด โช โญ โฅ โ โ โฉ โง โฎ โญ โฒ โท โฌ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โโ โ โก โ โ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโข โงโฌ โฉ โญ โง โช โฎ โ โ โฐ โฆ โถ โต โง โฆ โฑ โฐ โด โฉ โซ โท โฆ โท โ โด โช โต โ โญ โฅ โ โ โ โ โ โ Individual Checking (2) โข usually uses a checklist โข kickoff meeting suggests amount of time to spend: โญโฏโต โข checker records actual time taken โข keeps notes of issues found โข "issue" = matter requiring attention โโคโฃ โโโ
๏ฟฝ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โโ โ โ โ โ Logging Meeting (1) โข 3 purposes: โ log issues identified by each checker โ work as group to find more issues โ suggestions for process improvement (inspection process and overall software process) โข controlled by moderator (usually the leader) โ must be very skilled in handling people and issues โ maintain time discipline and issue discipline โข no evaluation of issues โ just log issues, like brainstorming โโคโฃ โโโ
๏ฟฝ โโ โ โโ โ โ โ โ โ โฅโฆ โ โ โโ โ โ โ โค โง โ โฅ โฅโฏ โฉ โง โญ โญ โฎ โฉ โ โ โชโญ โช โฌ โชโซ โฉ โ โ โ โ โ โ โ โ โ โ โ โโ โ โก โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ Logging Meeting (2) โข must not last more than 2 hours โข not for explaining, defending, suggesting fixes, or training โข identify issues, then log them โข issues can be questions to product author and suggestions for improvements โข NOT an attack or evaluation of product author โข management personnel should NOT be in attendance โโฃโข โโโ
๏ฟฝ โ โ ๏ฟฝ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โก โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ Edit โข log of issues given to author to resolve โข author can โ classify or reclassify issues (which are really defects) โ voluntarily improve product as per issues raised โ request rules or checklist be changed โโฃโข โโโ
๏ฟฝ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ โก โ โ โ โ โ โ โโ โ โ โ โ โ Follow-up โข inspection leader makes sure satisfactory closure has taken place on all issues โ actions to correct all defects (change or change request) โ suggestions for process changes reported โข if major changes, product may need to be inspected again โโฃโข โโโ
๏ฟฝ โ โ ๏ฟฝ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โก โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ Exit โข need exit criteria โข need closure on all issues in writing โข record metrics for inspection process (for process improvement) โข product now considered โsafeโ to pass on to next phase in software development โโฃโข โโโ
๏ฟฝโ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โ โ โโ โ โ โ The V-model Requirem ents System Test Inspection Architecture Integration Test Inspection Unit Test Design Inspection Inspection Code Cost of running inspections is about 10-15% of cost of development budget. โโคโฃ โโโ
๏ฟฝ โ โ ๏ฟฝ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โโ โ โ โ โ Costs of Inspection โข Inspection takes time โข Typically 10-15% of development budget โข Also start-up costs: โ establishing procedures โ training leaders, inspectors โข Is it worth it? โโคโฃ โโโ
๏ฟฝ โ โ ๏ฟฝ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โโ โ โ โ โ Benefits of Inspection (1) โข Defects found early save time and money โข many defects found before testing โ testing is much quicker โข total development time is reduced โ even when counting time for inspection โข inspections increase productivity โโคโฃ โโโ
๏ฟฝ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โโ โ โ โ โ โ โ Benefits of Inspection (2) โข Defects found early result in better product โข inspection results in โ cleaner design โ better documentation โ better code โ fewer defects โ defects that remain will be easier to fix when found โโคโฃ โโโ
๏ฟฝ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โโ โ โ โ โ โ Benefits of Inspection (3) โข feedback for mangement about software process: โ inspector's comments plus metrics โข defects found earlier means fewer deadline surprises โข inspection trains inspectors: โ learn from good code and documentation of others โ learn from mistakes of others โโคโฃ โโโ
๏ฟฝ โ โ โ โ โ โ ๏ฟฝ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโ โโ โ โ โ โโ โ โโ ๏ฟฝ โ โ โ โ โโ โ โโข โ โ โ โ โ โ โ โ โ โ โก โ โ โ โ โ โ โโ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ Success Stories (1) โข IBM Federal Systems Division โ kept metrics for similar projects before and after introducing Inspection into development process โ delivered lines of code per work-month: โโโ โกโโ โกโโ โโคโฃ โโโ
๏ฟฝ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโ โ โ โ โ โโ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โโ โ โ โ โ Success Stories (2) โข ICL (in U.K.): โ 57.7% of defects found by Inspection โ cost of finding defect by Inspection: 1.58 work hours โ cost of finding without Inspection: 8.47 work hours โ only 6% of development time devoted to Inspection โโฃโข โโโ
๏ฟฝ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโ โ โ โ โ โโ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โโ โ โ โ โ Success Stories (3) โข Large IBM project: โ 500,000 lines of code (networked operating system) โ based on past experience without inspection, expected to find about 800 bugs during tests at trial site โ used inspection at 11 stages of devopment โ found 8 bugs at trial site! โโฃโข โโโ
๏ฟฝ โ ๏ฟฝ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โก โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ Software Inspection Research (1) โข Research into inspection โ inspection process โ techniques for individual inspectors โโฃโข โโโ
๏ฟฝ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โโ โ โ โ โ โก โ โ โก โ โ โ โ โ โ ๏ฟฝ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โข โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โก โ โ โ โ โ โ โ โโ โ โ โ โโ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โโ โ โ โก โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโ โ โ โ โก โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โข research at Lucent Technologies (University Software Inspection โ experiment where they varied โโฃโข โโโ Research (2) โ one of the conclusions โโโ of Maryland) โโโ โโโ
๏ฟฝโ โ โ โ โ โ โ โ โ โ โ โ โก โฆ โ โ โ โ โ โ โ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โ โ โข โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โก โ โ โ โ โ โ โ โข โ โ โ โฅ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ โโข โ โข new techniques to help guide inspectors in Software Inspection โโคโฃ โ scenario-based reading Research (3) โโโ their work
๏ฟฝ โ โ โ โ ๏ฟฝ โ โ โ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โโ โ โ โ โ Checklists โข common guidance used for inspections โข good checklists are hard to make up โ rely on past experience โ can get too long and unwieldy โ need to be updated as new situations arise โ inspectors have a tendency to follow the checklist and do no more โ can be misinterpreted โ may not cover everything necessary to the right level of detail โโคโฃ โโโ
๏ฟฝ โฎ โฐ โญ โฆโด โฎ โณ โ โฌ โช โฏ โฌ โฌ โญ โน โช โช โฆ โฅ โง โง โ โ โด โ โ โท โณ โช โง โฌ โบ โ โฌ โฎ โฆ โญ โต โน โช โ โญ โญ โญ โฆโฑ โท โถ โช โฎ โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โก โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โช โโข โ โ โ โโ โ โ โ โ โ โ โท โ โ โ โ โ โฌ Approach for Checklists โข (general approach for inspections as well) โข determine what qualities are important for the software system โข determine what software design/code characteristics contribute to those qualities โข determine what you want the inspectors to look for โงโฉโ โซโฉโฌ โฐโฒโฑ โธโฉโฌ โซโฉโฌ โข checklist used for Assignment 4 is based on McCall's Quality Model โโคโฃ โโโ
McCall's Quality Model
๏ฟฝ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โโ โ โ โ โ โ โ Testing โข Now we move to the subject of testing โข Recall that software process should include both testing and inspection โข Inspecting documents & code before testing results in fewer defects for testing to find โ speeds up testing โข A bit of informal testing before code inspection might save time โ get rid of obvious bugs quickly โโคโฃ โโโ
๏ฟฝโ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โโ โ โ โ โ โ Testing is Hard! โข hits budget and schedule limits โข may include heavy debugging โ may even include product (re-)development โข bugs slip through to customers โ user executes untested code โ order in which statements are executed in actual use differ from that in testing โ user applies combination of untested input values โ userโs operating environment is never tested โโฃโข โโโ
๏ฟฝ โ โก โก โ โ โ โ โ ๏ฟฝ โ โ โ โ โ โ โ โ โ โ โ โข โ โ โ โ โ โ โฆ โ โ โ โ โ โ โ โ โ โ โ โก โ โ โ โก โค โ โ โ โโ โ โ โ โ โ โ โ โก โ โฅ โ โ โ โ โก โ โ โ โ โ โ โ โ โ โ โ โ โ โ โฅ โ โ โ โ โ โ โ โ ๏ฟฝ โ โ โ โ โ โ โ โก โ โ โ โ โก โ โ โ โก โ โ โฅ โ โ โ โ โก โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ ๏ฟฝ โ โ โ โ โ โก โ โ โค โก โก โ โ โก โ โ โ โ โฅ โง โ โ โ โค โก โ โ โ โก โ โ โ โ โ โ โโ โ โ โ ๏ฟฝ โ โ โ โ โ โ โ โโ โ โ โ โ โโ โ โ โ โก โ โก โ โโ โ โ โก โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โก โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ ๏ฟฝ โก โ โ โ โ โ โ โ โ โ โก โ โก โ โ โ โ โ โ โ โ โ โ ๏ฟฝ โโ โ โ โ โ โโ โ โ โก โก โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ ๏ฟฝ โ โ โ โ โ โโ โ โ โ โโก โโโ โข testers who are developers must have Skills of a Tester (1) โโฃโข โข Not all testers are developers โโโ โโโ โ โโก โโโฆ โโโ โโโ โโฃโข โโฃโข โโฃโข โโฃโข โโโ โโโ โโโ
๏ฟฝ โก โ โ โ โ โฅ โ โค โ โ โ โ โ โ โ โ โ โก โก โ โ โ โก โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โฅ โ โ โฆ โก โ โ โ โ โ โ โ โค โ โ โ โ โค โค โ โฅ โก โ โ โ โ โ โ โ โข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โโ โ โ โ โ โ โ โ โฅ โ โ โ โ โโ โ โ โ โโข โ โ โ โ โ โโโ Skills of a Tester (2) โข More skills employers look for: โโคโฃ โ software engineering skills โ hands-on experience โ communication skills โโโ โโโ โ organizational skills โโโ โโโ
๏ฟฝ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โโ โ โ โ โ โ โ Attitude For Testers โข destructive creativity โข detective skills โข understanding the product as the sum of its parts โข appreciating the customerโs perspective โข requirements change โข skeptical but not hostile attitude โข ability to be the bearer of bad news and remain objective โข an eagerness to embrace new technologies โโคโฃ โโโ
๏ฟฝ โ โ โ โ ๏ฟฝ โ โ โ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โโ โ โ โ โ โ โ Definitions of Testing (1) โข Myers, Glenford J., The Art of Software Testing, Wiley, 1979 โ โThe Process of executing a program with the intent of finding errorsโ โข Hetzel, Bill, A Complete Guide to Software Testing, QED Information Sciences Inc., 1988 โ "Testing is any activity aimed at evaluating an attribute or capability of a program or system and determining that it meets its required results." โโคโฃ โโโ
๏ฟฝ โ โ โ โ ๏ฟฝ โ โ โ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โโ โ โ โ โ Definitions of Testing (2) โข IEEE Standard 610.12-1990 โ โThe process of operating a system or component under specified conditions, observing or recording the results, and making an evaluation of some aspect of the system or componentโ โข IEEE Standard 829-1983 โ โThe process of analyzing a software item to detect the differences between existing and required conditions (that is , bugs) and to evaluate the features of the software itemsโ โโคโฃ โโโ
๏ฟฝ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โก โ โ โ โ โ โโ โ โ โ โ โ Purposes of Testing โข To find bugs - including bugs in the tests! โข To estimate reliability in use by tracking the execution time interval between failures โข To estimate defects remaining by tracking the defects found per person-hour of testing and debugging time โข To decide on when to release: e.g. by deciding that the remaining known defects are acceptable in the target market โข To learn where process problems are by classifying and counting defects found โโคโฃ โโโ
๏ฟฝ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โก โ โ โ โ โ โโ โ โ โ โ โ What Testing Can't Do โข Testing can't guarantee code is correct โข You can't try every possible combination of inputs, every environment โข Rigorous testing increases confidence that software runs correctly, or that few bugs remain โข For some critical software, formal mathematical methods used to "prove" correctness โ but that's another topic for other courses โโคโฃ โโโ
๏ฟฝ โ โ โ ๏ฟฝ โ โ โ โ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โโ โ โ โ โ โ โ Stages of Testing (1) โข Requirements and Design testing โ when requirements and design are written in special languages which permit "execution" to simulate actual system โข User Interface testing โ Often done at prototyping stage โข Unit/Module Testing โข Component/subsystem Testing โโคโฃ โโโ
๏ฟฝโ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โก โ โ โ โ โ โโ โ โ โ โ โ Stages of Testing (2) โข Integration Testing โ Incremental Testing -the usual version of integration testing. โข Daily builds and Sanity testing โข System Testing โ Performance and Load/Stress Testing โ Usability Testing, but this is a late stage to be doing it! โโคโฃ โโโ
๏ฟฝ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โโ โ โ โ โ Stages of Testing (3) โข Alpha and Beta Testing โ alpha = testing full system in-house โ beta = outside users โข Acceptance Testing โข Installation/Compatibility Testing โข Platform/Configuration/Port testing โโคโฃ โโโ
๏ฟฝ โ โก โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โโ โ โ โ โ โ โ โ โ โก โ โ โ โ โค โฃ โข โโข โ โ โก โก โ โ โ โ โ โ โโ โ โ โ โ โ โฅ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โ โ โฌโญ โซ โ โฅ โก โ โค โ โฉ โช โฉ โ โ โง โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โฆ โ โก โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โก โ โ โ โก โ โ โ โ โ โก โ โ โ โ โ โ โ โ โ โ โ โ โ โโข โ โ โ โ โโ โ โ ๏ฟฝ โ โ โโ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โก โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โก โ โ โก โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โก โ โก โ โ โ โ โ โ โ โ โ โ โ โ โ โข Security/Fault Tolerance/Recovery testing โ โโก โโโโ Stages of Testing (4) โข Reliability/Certification Testing โโโ โข Integrity and Release testing โโโ โโคโฃ โโโ โโโ โโโ โข Regression Testing โโโ โโโ โ โโก โโโ โโโ โโโ
๏ฟฝโ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โ โโ โ โ โ โ Black Box Testing โข pick test cases based on requirements only โข don't use knowledge of implementation โข view code as a black box: insides not visible โข can be used at any stage: โ unit, subsystem, system testing โโคโฃ โโโ
๏ฟฝโ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โโ โ โ โ โ โ Black-Box Testing Strategies โข look at specifications for inputs โข test normal use: โ sampling of "normal" inputs (random values) โข test abnormal use: โ different kinds of erroneous/illegal input โ combinations of errors โข test boundary conditions: โ values close to boundary between normal and abnormal โโคโฃ โโโ
๏ฟฝ โ โ โ โ โ โ ๏ฟฝ โ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โ โ โ โโ โ Example /** * Raises a number to an integral power. * * @param base the number to be raised to a power * @param pow the power to which base is to be raised. * Must not be negative. * @return base raised to the pow-th power */ static double power(double base, int pow) { โข error inputs: negative values for pow โข boundary cases: pow = 0, pow = 1, pow = -1 โข normal cases: โ pow >= 2, range of values โ base: negative, 0, positive โ combinations of these โโคโฃ โโโ
๏ฟฝ โ โ โ ๏ฟฝ โ โ โ โ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โโ โ โ โ โ Possibilities For Automation โข Ideal: tool to generate set of test cases and expected results from specifications โข Reality: needs very precise, mathematical specifications, usually not available โข So usually generate test cases & expected results by hand โข Automated execution is still possible โโคโฃ โโโ
๏ฟฝ โ โ โ โ ๏ฟฝ โ โ โ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โโ โ โ โ โ โ โ Test Harness โข Takes set of test inputs & expected results โข Runs program on each test input, compares results with expected โข Reports any discrepancies โข Complicated to write for GUIs, embedded systems, but often possible โข Takes lots of drudgery out of testing โข Makes testers willing to run and re-run large test suites โโคโฃ โโโ
๏ฟฝ โ โ ๏ฟฝ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ โก โ โ โ โ โโ โ โ โ โ โ โ White Box Testing โข Pick test cases based on the actual software โข also called "clear box" or "structural" testing โข key word is coverage : โ do the test cases cover all of the code? โข different measures of coverage โโคโฃ โโโ
๏ฟฝโ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โก โ โ โ โ โ โโ โ โ โ โ โ Statement Coverage โข Every statement in the software must be executed at least once by the test cases โข Quote from text (Murray): โ "Testing less than this for new software is unconscionable and should be criminalized" โข NASA story โโคโฃ โโโ
๏ฟฝ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โโ โ โ โ โ โ โ Branch Coverage โข Every branch alternative must be covered by at least one test case โข More demanding than statement coverage: if (x > 3) y = 14; // continue -- no else part โข We need at least one test case where x > 3 is and at least one where x > 3 is false. โโคโฃ โโโ
๏ฟฝ โ โ โ โ โ โโ โ โ โ โโข โ โ โ โ โ โ โ ๏ฟฝ โ โ โ ๏ฟฝ โ โ โโ ๏ฟฝ โ โก โ ๏ฟฝ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โก โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ Path Coverage โข Every possible path through the program must be covered by at least one test case void tst(int x) { if (x>0) pos = pos+1; if (x%2==0) even = even+1; return; โ โ โโโ } โข Needs 4 test cases: โ โ โโโ โ all combinations alternatives โโคโฃ โโโ
๏ฟฝโ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โ โ โ Example void tst(int x) { if (x>0) pos = pos+1; if (x%2==0) even = even+1; } โข Statement Coverage: tst(2) โข Branch Coverage: tst(-1),tst(2) โข Path Coverage: tst(-2),tst(-1),tst(1),tst(2) โโฃโข โโโ
๏ฟฝ โ โ ๏ฟฝ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โ โ โ โ โ โ What About Loops? โข May require test cases which make each loop execute 0 times, 1 time, many times โข for (int i = 0; i < n; i++) {...} โ Test cases should include: โข n <= 0 (no times around the loop) โข n = 1 (one time around the loop) โข n > 1 (several times around the loop) โโฃโข โโโ
๏ฟฝ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ โก โ โ โ โ โโ โ โ โ โ โ โ More About Loops โข real time software generally runs inside an infinite loop โ need to carefully define what you mean by path or loop coverage โโคโฃ โโโ
๏ฟฝ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โโ โ โ โ โ โ Path Coverage: Impossible Combinations โข Not all combinations are possible: if (x > 2) ... else ... if (x > 4) ... else ... โข impossible to have first loop false, second true โ no test case for that combination โโคโฃ โโโ
๏ฟฝ โ โ โ โ โ ๏ฟฝ โ โ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โโ โ โ โ โ Path Coverage: Combinatorial Explosion โข Large method with many branches and loops: โ many combinations, lots of test cases โ difficult to manage โ May catch sepcial inputs that trigger an error โข Full path coverage only practical for unit testing โโคโฃ โโโ
๏ฟฝ โ โ โ โ โ โ โ ๏ฟฝ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โ โ โโ โ โ Example static double power(double base, int pow) { double answer = 1; while (pow > 0) { if (pow % 2 == 0) { // pow is even pow = pow / 2; base = base * base; } else { // pow is odd pow = pow - 1; answer = answer * base; } // end if } // end while return answer; } // end power White box checklist: pow = 0, 1, 2, bigger (so while loop executed 0, 1, many times) even and odd powers to exercise both parts of if statement โโคโฃ โโโ
๏ฟฝ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โโ โ โ โ โ โ Data Flow Testing โข Another kind of white box testing โข exercise (in order of weakest to strongest testing) โ all input and output variables โ both truth values of all predicates โ all definitions of variables (eg variables on LHS of assignments) โ all uses of variables that are defined โ all loops โโคโฃ โโโ
๏ฟฝ โ โ โ โ โ โ โ โ โ โ โ โ โซ โ โ โข โช โ โ โ โ โฎ โ โ โ โ โ โ โ ๏ฟฝ โ โ โ โ โฉ โ โ โ โ โ โ โ โช โ โ โ โ โฃ โ โ โ โ โ โช โ โ โ โ โ โฃ โ โ โ โ โ โฏ โ โฌ โข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โซ โฃ โซ โ โ โ โฉ โ โซ โฆ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โก โ โ โข Ideal: tool to generate set of test cases satisfying โโโ Possibilities For Automation โโงโฆ โข Can't generate expected output from code! โโโ โข Some help: tools to help verify coverage: โโโ โฃโฅโค โโโ โโคโฃ coverage requirements โโญโฌ โโโ โโโ โโโ โโโ โโโ โโโ โโโ โโโ โโโ
๏ฟฝ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โโ โ โ โ โ White Box Alone โข White box alone is not a good way to generate test cases. โ may lead to focus on less important parts โ intrinsically leads to incomplete testing โ if coder overlooked possibilities, test cases will not detect them โโคโฃ โโโ
๏ฟฝ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โโ โ โ โ โ Black Box Alone โข Black box alone may not cover the code adequately โ some special cases are not obvious from specifications, depend on algorithms โข Studies examined black box test suites developers considered extremely thorough โ only exercised 1/3 to 1/2 of code! โโคโฃ โโโ
๏ฟฝ โ โโ โก โก โ โ โ โ โ โ โ โ โ โ โ โ โ โ ๏ฟฝ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โก โ โโ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โก โ โ โ โ โ โโ โ โ โ โ โ โ โ โโข โ โ โ โ โโ โ โ โ โ โ โ โ โ โ Another Example: Background โข Heron's formula for area of triangle: + + a b c โ let s = 2 โ โ โ s s a s b s c ( )( )( ) โ area = โข Example program takes three sides of triangle as command-line arguments (string form) โข checks to make sure it's an equilateral triangle โโโ โโโก โโโ โโโก โโคโฃ โโโ
๏ฟฝ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โ โ โโ โ โ Example Code with two Branches public class Triangle { public static void main(String args []) { int sideA = Integer.parseInt(args[0]); int sideB = Integer.parseInt(args[1]); int sideC = Integer.parseInt(args[1]); if ((sideA == sideB) && (sideA == sideC)) { double s = 0.5 * (sideA + sideB + sideC); double area = Math.sqrt(s / (s - sideA) * (s - sideB) * (s - sideC)); System.out.println("area = " + area); } else System.out.println("not equilateral"); } // end main } // end class โโคโฃ โโโ
๏ฟฝ โ โ โ ๏ฟฝ โ โ โ โ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โโ โ โ โ โ โ โ Branch Coverage โข one if statement, so two test cases needed โข false case: pick sides that aren't equal โ run Triangle 2 3 4 โ output: not equilateral โข true case: pick equal sides โ run Triangle 2 2 2 โ output: area = 1.7320508075688772 โข output is correct, looks like all is well โโคโฃ โโโ
๏ฟฝโ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โ โ โโ โ โ โ Two Errors not Caught by Test Cases public class Triangle { public static void main(String args []) { int sideA = Integer.parseInt(args[0]); int sideB = Integer.parseInt(args[1]); int sideC = Integer.parseInt(args[1]); should be 2 if ((sideA == sideB) && (sideA == sideC)) { double s = 0.5 * (sideA + sideB + sideC); double area = Math.sqrt(s / (s - sideA) * (s - sideB) * (s - sideC)); System.out.println("area = " + area); should be * } else System.out.println("not equilateral"); } // end main } // end class โโคโฃ โโโ
๏ฟฝ โ โ โ โ ๏ฟฝ โ โ โ โ โ โ โโ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โก โ โ โ โ โ โ โ โ โโ โ โ โ โ Combining the Two Approaches โข pick a set of test cases from the specification (black box) โข then look at code (white box) and see if test cases cover the code adequately โข it not, add more to complete coverage โข power example: โ black box alone didn't tell us it was important to make sure we tested both odd and even powers โ suggests additional test cases: pow = 16, pow = 15 โโคโฃ โโโ
๏ฟฝ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โโ โ โ โ โ โ โ โ โ โก โ โ โ โ โ โโ โ โ โ โ โ Testing at Different Levels โข Unit testing: โ dual black box/clear box approach โ level of smallest granularity: want to look at code โข Above unit testing level: gray box โ awareness of structure, but not all details, โข System testing: primarily black box โโคโฃ โโโ
๏ฟฝ โ โ โ โ ๏ฟฝ โ โ โ โ โ โ โ ๏ฟฝ โโข โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โก โ โโ โ โ โ โ โ โ โ โ โ โ โ โ โก โ โ โ โ โ โ โโ โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ Stages โข Big Bang Testing: go right to System Testing โ generally least effective โ very difficult to find bugs โ avoid this! โข Better way: โ test all modules individually (unit testing) โ put together gradually & test larger pieces โโโ โโโ โ finally test whole system โโคโฃ โโโ
๏ฟฝ ๏ฟฝ โฌ โซ โฉโช โ โง โฆ โฅ โ โง โ โ โ โ โ โ โ โ โญ โฉ โ โฌ โฑ โซ โฎ โซ โฌ โฐ โฆ โฅ โฅ โญ โ โช โฏ โ โง โซ โฎ โฌ โ โโข โโ โ โ โ โ โ โ โ โ โ โ โก โ โ โ โ โ โ โโ โ โ โ โ โโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ Integration Testing โข Tests uses between modules - source of 40% of all errors in code. โข Incremental: Top Down vs. Bottom Up โ start with tested modules in either case โ planning of increments starts early โฆโณโฒ โ top down requires stubs โ bottom up requires drivers โ 'sandwich' variants exist โโคโฃ โโโ
Recommend
More recommend