Software Engineering, CPSC-4360-01, CPSC-5360-01, Lecture 11

download Software Engineering,  CPSC-4360-01, CPSC-5360-01, Lecture 11

of 64

  • date post

    07-Jan-2016
  • Category

    Documents

  • view

    38
  • download

    1

Embed Size (px)

description

Software Engineering, CPSC-4360-01, CPSC-5360-01, Lecture 11. Review of Last Lecture. Implementing a Statechart Review of Java programming concepts Inheritance Polymorphism Type Casting Interface. Overview of This Lecture. Software Testing Overview Test Phases Unit Testing - PowerPoint PPT Presentation

Transcript of Software Engineering, CPSC-4360-01, CPSC-5360-01, Lecture 11

  • *CPSC-4360-01, CPSC-5360-01, Lecture 11*Software Engineering, CPSC-4360-01, CPSC-5360-01, Lecture 11

    CPSC-4360-01, CPSC-5360-01, Lecture 11

  • *CPSC-4360-01, CPSC-5360-01, Lecture 11*Review of Last LectureImplementing a StatechartReview of Java programming conceptsInheritancePolymorphismType CastingInterface

    CPSC-4360-01, CPSC-5360-01, Lecture 11

  • *CPSC-4360-01, CPSC-5360-01, Lecture 11*Overview of This LectureSoftware TestingOverviewTest PhasesUnit TestingIntegration TestingOO Specific TestingAutomated Test DriverOverviewExample

    CPSC-4360-01, CPSC-5360-01, Lecture 11

  • *CPSC-4360-01, CPSC-5360-01, Lecture 11*Where are we now?Evaluating the System

    CPSC-4360-01, CPSC-5360-01, Lecture 11

  • *CPSC-4360-01, CPSC-5360-01, Lecture 11*Testing Famous QuotesTesting is the process of comparing the invisible to the ambiguous, so as to avoid the unthinkable happening to the anonymous., James Bach

    "Testing is organised skepticism., James Bach

    "Program testing can be used to show the presence of bugs, but never to show their absence!, Edgar Dijkstra

    "Beware of bugs in the above code; I have only proved it correct, not tried it., Donald Knuth

    CPSC-4360-01, CPSC-5360-01, Lecture 11

  • *CPSC-4360-01, CPSC-5360-01, Lecture 11*Testing: DefinitionsTesting is the process of establishing confidence that a program or system does what it is supposed to.Testing is the process of executing a program or system with the intent of finding errors.Testing is any activity aimed at evaluating an attribute or capability of a program or system and determining that it meets its required results.

    CPSC-4360-01, CPSC-5360-01, Lecture 11

  • *CPSC-4360-01, CPSC-5360-01, Lecture 11*Testing: OverviewA software test process is based on well-defined software quality control and testing standards, testing methods, strategy, test criteria, and tools.Engineers perform all types of software testing activities to perform a software test process.The last quality checking point for software is on its production line.

    CPSC-4360-01, CPSC-5360-01, Lecture 11

  • *CPSC-4360-01, CPSC-5360-01, Lecture 11*Testing: ObjectivesUncover as many errors (or bugs) as possible in a given time.Demonstrate that a given software product matches its requirement specifications.Generate high quality test cases, perform effective tests, and issue correct and helpful problem reports.

    CPSC-4360-01, CPSC-5360-01, Lecture 11

  • *CPSC-4360-01, CPSC-5360-01, Lecture 11*Testing: ObjectivesUncover the errors (defects) in the software, including errors in: requirements from requirement analysis.design documented in design specifications.coding (implementation).system resources and system environment.hardware problems and their interfaces to software.

    CPSC-4360-01, CPSC-5360-01, Lecture 11

  • *CPSC-4360-01, CPSC-5360-01, Lecture 11*Testing: Personnel Test Manager:Manage, supervise, and control a software test project.Define and specify a test plan.Software Test Engineers and Testers:Define test cases, write test specifications, run tests.Development Engineers:Only perform unit tests and integration tests.Quality Assurance Group and Engineers:Perform system testing.Define software testing standards and quality control process.Independent Test Group.

    CPSC-4360-01, CPSC-5360-01, Lecture 11

  • *CPSC-4360-01, CPSC-5360-01, Lecture 11*Testing: ActivitiesTest Planning:a test schedule for a test process and its activities, as well as assignments.test requirements and items.test strategy and supporting tools.Test Design and Specification:conduct software design based on well-defined test generation methods.specify test cases to achieve a targeted test coverage.

    CPSC-4360-01, CPSC-5360-01, Lecture 11

  • *CPSC-4360-01, CPSC-5360-01, Lecture 11*Testing: ActivitiesTest Set up:Testing Tools and Environment Set-up.Test Suite Set-up.Test Operation and Execution:Run test cases manually or automatically.Test Result Analysis and Reporting:Report software testing results and conduct test result analysis.Problem Reporting:Report program errors using a systematic solution.

    CPSC-4360-01, CPSC-5360-01, Lecture 11

  • *CPSC-4360-01, CPSC-5360-01, Lecture 11*Testing: ActivitiesTest Management and Measurement:Manage software testing activities, control testing schedule, measure testing complexity and cost.Test Automation:Define and develop software test tools.Adopt and use software test tools.Write software test scripts.Test Configuration Management:Manage and maintain different versions of software test suites, test environment and tools, and documents for various product versions.

    CPSC-4360-01, CPSC-5360-01, Lecture 11

  • *CPSC-4360-01, CPSC-5360-01, Lecture 11*Testing: Cycle of ActivitiesTesting usually involves repetition of testing activities.Example:

    CPSC-4360-01, CPSC-5360-01, Lecture 11

  • *CPSC-4360-01, CPSC-5360-01, Lecture 11*Test OrganizationIn a large software system, testing has to be carried out in multiple stages.The test stages are linked to the various software development stages.Example:The Acceptance Test is linked to the Requirement and the Specification stages.Also known as the V-Model, it refers to the next slide to see the alphabet V in the diagram.

    CPSC-4360-01, CPSC-5360-01, Lecture 11

  • *CPSC-4360-01, CPSC-5360-01, Lecture 11*Testing Organization (V-Model)ProduceValidateRequirements specificationSystem SpecificationSystem DesignModule DesignCodingUnit TestingIntegration TestingSystem TestingAcceptance TestingUser SpecificationSystem SpecificationSoftware SpecificationModule SpecificationProduceValidateProduceValidateProduceValidate

    CPSC-4360-01, CPSC-5360-01, Lecture 11

  • *CPSC-4360-01, CPSC-5360-01, Lecture 11*Test Stage: Unit TestTesting individual modules:Methods or Functions.Classes.Sometimes class clusters.It is based on the information about the structure of a code fragment.Carried out by the Development Engineer.The objective is to test that the unit performs the function for which it is designed.Unit tests can be designed before coding begins, or just after the source code is generated.

    CPSC-4360-01, CPSC-5360-01, Lecture 11

  • *CPSC-4360-01, CPSC-5360-01, Lecture 11*Unit Test: Check List Interface:To ensure information properly flows in and out.Data structure:To ensure the stored data maintains integrity.Boundary conditions:Module operates properly at boundaries.Independent paths:All paths through the control structure are exercised.Error handling paths:paths that handle errors are exercised.

    CPSC-4360-01, CPSC-5360-01, Lecture 11

  • *CPSC-4360-01, CPSC-5360-01, Lecture 11*Test case:Test data; should be coupled with expected results.Often lists Test identifier; Test objectives; Test resources; Test procedure. Driver:A module that has the test case data, passes it to component under testing, and logs the results.Stub:A dummy module that is called by the component under testing. Unit Test: Test Setup

    CPSC-4360-01, CPSC-5360-01, Lecture 11

  • *CPSC-4360-01, CPSC-5360-01, Lecture 11*Example (Stub)Module AStub B Stub C Stub DStub B

    Print in BReturnModule A

    Call Stub BCall Stub CCall Stub D

    Stub C

    Print in CReturnStub D

    Print in DReturnTemporary ImplementationModule Under Test

    CPSC-4360-01, CPSC-5360-01, Lecture 11

  • *CPSC-4360-01, CPSC-5360-01, Lecture 11*Generating Unit Test CasesStatement coverage.Graph based:Branch coverage.Condition coverage.Path coverage.These are also applicable to testing methods within a class.

    CPSC-4360-01, CPSC-5360-01, Lecture 11

  • *CPSC-4360-01, CPSC-5360-01, Lecture 11*Unit Testing: Object Oriented CodeClass level testing:Operations in the class are smallest testable units.Testing single operation in isolation is difficult.Unit test is generally driven by structure of methods of the class and the state behavior of class.Recall - the state-transition model and the state of an object.

    CPSC-4360-01, CPSC-5360-01, Lecture 11

  • *CPSC-4360-01, CPSC-5360-01, Lecture 11*Unit Testing: Object Oriented CodeA public method in a class can be tested using a black-box approach.Start from the specification - class interface.Consider each parameter in the method signature, and identify its possible data range(s):Equivalence Classes - a black box test approach.Incorporate pre-conditions and post-conditions in the test of a method.Test exceptions.For complex logic, also use white-box testing or static testing.

    CPSC-4360-01, CPSC-5360-01, Lecture 11

  • *CPSC-4360-01, CPSC-5360-01, Lecture 11*Unit Testing: Object Oriented CodeFor private methods, either modify the class (temporarily) so that it can be tested externally:change the access to public.or incorporate a test driver within the class.or use static test methods, such as program tracing.

    CPSC-4360-01, CPSC-5360-01, Lecture 11

  • *CPSC-4360-01, CPSC-5360-01, Lecture 11*Using StatechartCreate test cases corresponding to each transition path that represent a full object life cycle.Make sure each transition is exercised at least once.

    CPSC-4360-01, CPSC-5360-01, Lecture 11

  • *CPSC-4360-01, CPSC-5360-01, Lecture 11*Example (Account from Lecture 10)

    CPSC-4360-01, CPSC-5360-01, Lecture 11

  • *CPSC-4360-01, CPSC-5360-01, Lecture 11*Example (cont)Possible Test Cases:init, deposit(500), withdraw(500):Should be in InCredit state.init, deposit(10), withdraw(20), deposit(5):Should be in OverDrawn state.init, deposit(10), withDraw(20), deposit(50), suspend(), unsuspend():Should be in InCredit state.The above test cases exercised each transition at least