1 / 11

Lesson 15: Testing

Lesson 15: Testing. Software Engineering II. Lesson Objectives. Understand the importance of testing Learn how to maximize the effectiveness of unit testing using OO Understand why OO minimizes regression testing Understand why OO facilitates automated testing

Télécharger la présentation

Lesson 15: Testing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lesson 15:Testing Software Engineering II

  2. Lesson Objectives • Understand the importance of testing • Learn how to maximize the effectiveness of unit testing using OO • Understand why OO minimizes regression testing • Understand why OO facilitates automated testing • Learn when to automate testing

  3. IMPORTANCE OF PROPER TESTING • Validate the system for use • Defect free code a must for successful reuse • Users associate defects with quality

  4. MAXIMIZING THE EFFECTIVENESS OF UNIT TESTING • Keep object interfaces to a minimum • High level of cohesion - object contains only functionally related components • Keep objects a reasonable size • Build large objects out of small objects • How to determine correct size: • McCabe’s Complexity Metric • Halstead’s Metrics • Rule of Thumb: Methods no more than two pages

  5. 1 3 4 5 6 7 8 9 1 0 1 1 2 MCCABE COMPLEXITY ANALYSIS AIDS UNIT SIZING • Graph shows potential execution paths • Complexity to be kept below a predetermined threshold • No unstructured code sequences FOR MORE INFORMATION: McCabe Associates Twin Knolls Professional Park 5501 Twin Knolls Rd. Suite 111 Columbia, MD 21045

  6. HALSTEAD’S SOFTWARE SCIENCE - DEFINITIONS • Determine difficulty from the program • Calculate vocabulary of the program • Vocabulary = n1 + n2, where • n1=Number of unique operators • n2=Number of unique operands • Calculate length of the program • Length = N1 + N2, where • N1=Total operators • N2=Total operands • Calculate difficulty from vocabulary and length FOR MORE INFORMATION: Halstead, Maurice H. Elements of Software Science Elsevier North Holland, Inc. 1977

  7. F4 F3 F1 S2 S1 F5 OO MINIMIZES REGRESSION TESTING • Regression testing retests capabilities after an update • Before OO, encapsulation was not enforced • This led to . . . Many units have access to the same data! Changing F2 could impact all other functions! F2a

  8. OO MINIMIZES REGRESSION TESTING Encapsulation and Information Hiding prevent unintentional interactions Changing this object has little or no impact on other objects! O1a O3 O4 O5 O2

  9. OO FACILITATES AUTOMATED TESTING • Automated test generation techniques work well for OO • Objects provide manageable units • Encapsulation provides natural test boundaries • Rigorous interfaces help generation of thorough test cases

  10. WHEN TO AUTOMATE TESTING • Very large applications • Test more frequently during development • Narrow down changes to smaller sections of new code • Long life-cycle applications • Captures test cases when experts are still available • Frequently upgraded applications • Formal testing repeated many times

  11. TESTING SUMMARY • OO maximizes the effectiveness of unit testing • Encapsulation minimizes impacts, reducing errors in regression testing • OO is well suited for automated testing • Automate testing for: • Very large applications • Long life-cycle applications • Frequently upgraded applications

More Related