Danh mục

Object-Oriented Testing

Số trang: 47      Loại file: pdf      Dung lượng: 599.44 KB      Lượt xem: 19      Lượt tải: 0    
Hoai.2512

Phí tải xuống: 9,000 VND Tải xuống file đầy đủ (47 trang) 0
Xem trước 5 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Unit testing, but we expand the definition of unit Component testing to make sure individual subsystems work correctly Integration testing to make sure subsystems work correctly together System testing to verify that requirements are met Regression testing to make sure previous
Nội dung trích xuất từ tài liệu:
Object-Oriented TestingObject-Oriented TestingContents Why OO Testing? Impact of OO on Testing OO Testing Phases Testing OO Systems Specific OO Testing Techniques 2Why OO Testing? 3Why OO Testing? Object-oriented development provides an abstract way of thinking a problem  Absent in traditional structured-oriented development Techniques and tools for testing a traditional structured-oriented software are not sufficient to completely test object-oriented systems  OO poses some new challenges on testing systems  Conventional techniques can be used but they probably will not be enough 4OO Testing OO Testing is Still “Testing”  We still do  Unit testing, but we expand the definition of unit  Component testing to make sure individual subsystems work correctly  Integration testing to make sure subsystems work correctly together  System testing to verify that requirements are met  Regression testing to make sure previous functionality still works after new functionality is added  But… 5OO Testing Testing strategy changes  The concept of the unit broadens due to encapsulation  Integration focuses on classes and their execution across a thread or in the context of a use case  e.g. Do your classes work together to allow a user to complete a task from your scenarios?  Validation uses conventional black box methods  Test case design draws on conventional methods, but also encompasses special features 6OO Testing Although  Object-oriented analysis and design can lead to a better system architecture, and  Object-oriented programming enforces a disciplined coding style Object-Orientation does not  Shield against programmers’ mistakes or a lack of understanding of the specification  Ensure the production of correct programs by itself Object-oriented systems still need Testing 7Impact of OO on Testing 8Impact of OO on Testing Common features of OO development are complex and, therefore, prone to errors  Encapsulation  Information hiding  Inheritance  Consistency in abstraction hierarchy  Multiple inheritance  Polymorphism  Dynamic binding  Exception Handling 9Encapsulation A control access mechanism that determines the visibility of methods and attributes in a class Enforces information hiding  The interface and implementation of a class may be syntatically separated  Avoids undesirable dependencies between client and a server class  Only the class interface is visible to the client  Design decisions and implementation details are hidden Encourages program modularity Restricts the implication of changes 10Impact of Encapsulation onTesting Testing requires  A complete report on the states of an object  The possibility to change states easily Why does encapsulation make OO testing harder?  Lack of visibility of states  Besides the behavior encapsulated by an object, it also encapsulates states  Difficulty in initializing data items  Difficulty in calling methods Encapsulation does not directly contribute to the introduction of faults, it may be an obstacle in testing by reducing controllability and observability 11Inheritance Relationship between classes that allows the definition of a new (derived) class based on the definition of an existing (base) class The derived class can then be refined by modifying or removing the inherited operations, or by adding new properties Single inheritance  Properties are inherited from a single class  Strict: the derived class can only be refined by adding new properties  Subtyping: besides the properties of strict refinement, it allows the redefinition (overriding) of the inherited properties Multiple inheritance  Properties are inherited from multiple (many) classes 12Inheritance Allows reuse of both specification and implementation  Shares features present in classes previously defined The preexisting classes do not have to be modified or made aware of the new class 13Inheritance Inheritance can contribute to errors in several ways  Weakens encapsulation  Introduces hazards similar to those associated with global data in conventional languages  Used inappropriately as  A powerful macro substitution for convenience  A model of hierarchy  Can lead to homograph operations  Two or more classes with similar name and profile  When using multiple inheritance  Leads to side-effects, inconsistencies or incorrect behavior  Deep and wide inheritance hierarchies can defy comprehension  Leads to errors and reduction of testability ...

Tài liệu được xem nhiều:

Gợi ý tài liệu liên quan: