Object-Oriented Testing pdf

47 181 1
Object-Oriented Testing pdf

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Object-Oriented Testing 2 Contents  Why OO Testing?  Impact of OO on Testing  OO Testing Phases  Testing OO Systems  Specific OO Testing Techniques 3 Why OO Testing? 4 Why 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 5 OO 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… 6 OO 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 7 OO 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 8 Impact of OO on Testing 9 Impact 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 10 Encapsulation  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 [...]... Procedural vs Object-Oriented Testing Testing Phases Procedural Testing Unit Testing Procedure or Subroutine Object-Oriented Testing Class (Methods) Integration Testing Two or More Procedures Two or More Classes System Testing Entire System Entire System 26 Procedural vs Object-Oriented Testing Procedural Testing Object-Oriented Testing Unit Intra-procedural Intra-method, Inter-method and Intra-class Integration... Inter-method testing   Multiple methods within a class are tested in concert Intra-class testing   Testing a single class, usually using sequences of calls to methods within the class Inter-class testing   More than one class is tested at the same time (integration) 21 Unit Testing  We will consider a “Class” as the proper subject of unit testing  Smallest stand-alone unit for testing   ... message passing influence how much testing will be needed  Intra-method, inter-method and intra-class testing approaches can be used 22 Unit Testing  Intra-Method Testing  Tests a specific method of a class  Inter-Method Testing  Methods of the same class may interact to implement a given functionality   Kind of integration that should be tested Intra-Class Testing  Tests public method interactions... System Testing  Considers the OO software as a “whole”    Looks for the errors in the whole system, including operating system call errors, performance errors, partition errors Alpha and beta testing can also be used as a complement Generally based on black box criteria  No fundamental difference from procedural and OO software 25 Procedural vs Object-Oriented Testing Testing Phases Procedural Testing. .. Polymorphism on Testing  Brings undecidability to testing   Each possible binding of a polymorphic component requires a separate test   Dynamic binding: unanticipated bindings It may be difficult to find/exercise all such bindings Erroneous casting (type conversions)  Can lead to non-easily detectable errors 19 OO Testing Phases 20 Testing OO Software Intra-method testing   Testing individual... Inter-class System Entire system Entire system Phase 27 Testing OO Systems 28 Testing OO Systems  Base Class  Testing base classes is similar to unit testing of modules in traditional systems   Goal: ensure the base classes work correctly in isolation, before their integration Manually prepare a “thorough” test suite  Apply it to each base class 29 Testing OO Systems  A complete object test suite requires... Also test their interactions 31 Testing OO Systems  Testing a subclass  New or untested feature in the subclass  Develop new complete test suite for it  Prepare intra- and inter-class tests   Test a new data member by testing the class methods with which it interacts Inherited Features  Very limited retesting of classes is required  Integration testing is required if class either   Interacts... Accesses the same instances in the class’s representation as other methods 32 Testing OO Systems  Testing a subclass  Redefined Features  May be able to reuse black box test cases   Functionality unchanged New white box tests will be required  Implementation sure to change 33 Specific OO Testing Techniques 34 Specific OO Testing Techniques  Traditional       State Machines   Events, Transitions... Interaction Tests Exception Testing (exceptions/handlers) 35 State Machine-based Intraclass Testing  Basic idea     The state of an object is modified by operations Methods can be modeled as state transitions Test cases are sequences of method calls that traverse the state machine model State machine model can be derived from specification (functional testing) , code (structural testing) , or both 36 ... performed 30 Testing OO Systems  Testing a subclass  Test the subclass class in conjunction with its parent  Determine test cases required for the subclass   Incrementally update the parent class history (methods tested, test suite applied, test status) to reflect differences from the parent class Test new attributes or those inherited, affected attributes  Also test their interactions 31 Testing . Object-Oriented Testing 2 Contents  Why OO Testing?  Impact of OO on Testing  OO Testing Phases  Testing OO Systems  Specific OO Testing Techniques 3 Why OO Testing? 4 Why OO Testing? . test object-oriented systems  OO poses some new challenges on testing systems  Conventional techniques can be used but they probably will not be enough 5 OO Testing  OO Testing is Still Testing . together  System testing to verify that requirements are met  Regression testing to make sure previous functionality still works after new functionality is added  But… 6 OO Testing  Testing strategy

Ngày đăng: 08/07/2014, 00:20

Tài liệu cùng người dùng

Tài liệu liên quan