Object-Oriented Testing
Thông tin tài liệu:
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ìm kiếm theo từ khóa liên quan:
ngôn ngữ lập trình phương pháp lập trình lập trình cơ bản php ngôn ngữ C++ giáo trình html cơ bảnGợi ý tài liệu liên quan:
-
Giáo trình Lập trình hướng đối tượng: Phần 2
154 trang 276 0 0 -
Bài thuyết trình Ngôn ngữ lập trình: Hệ điều hành Window Mobile
30 trang 267 0 0 -
Kỹ thuật lập trình trên Visual Basic 2005
148 trang 266 0 0 -
Giáo trình Lập trình cơ bản với C++: Phần 1
77 trang 232 0 0 -
Bài giảng Một số hướng nghiên cứu và ứng dụng - Lê Thanh Hương
13 trang 226 0 0 -
Giáo án Tin học lớp 11 (Trọn bộ cả năm)
125 trang 218 1 0 -
NGÂN HÀNG CÂU HỎI TRẮC NGHIỆM THIẾT KẾ WEB
8 trang 208 0 0 -
Giáo trình Lập trình logic trong prolog: Phần 1
114 trang 195 0 0 -
Bài tập lập trình Windows dùng C# - Bài thực hành
13 trang 186 0 0 -
Giáo trình Lập trình C căn bản
135 trang 170 0 0 -
Giáo trình Lập trình C căn bản: Phần 1
64 trang 170 0 0 -
Bài giảng Nhập môn về lập trình - Chương 1: Giới thiệu về máy tính và lập trình
30 trang 168 0 0 -
Thiết kế mạch logic bằng Verilog - HDL
45 trang 164 0 0 -
Báo cáo thực tập: Quản lý nhân sự & tiền lương
52 trang 154 0 0 -
Giáo trình nhập môn lập trình - Phần 22
48 trang 139 0 0 -
Giáo trình Lập trình C căn bản - HanoiAptech Computer Education Center
136 trang 134 0 0 -
14 trang 134 0 0
-
LUẬN VĂN: ỨNG DỤNG NGÔN NGỮ LẬP TRÌNH RÀNG BUỘC COMET VÀO BÀI TOÁN LẬP THỜI KHÓA BIỂU
43 trang 132 0 0 -
Giáo trình lập trình hướng đối tượng - Lê Thị Mỹ Hạnh ĐH Đà Nẵng
165 trang 112 0 0 -
Bài giảng Phương pháp lập trình: Chương 9 - GV. Từ Thị Xuân Hiền
36 trang 112 0 0