4/25/2015CPSC-4360-01, CPSC-5360-01, Lecture 111 Software Engineering, CPSC-4360-01, CPSC-5360-01,...

Click here to load reader

  • date post

    14-Dec-2015
  • Category

    Documents

  • view

    225
  • download

    4

Embed Size (px)

Transcript of 4/25/2015CPSC-4360-01, CPSC-5360-01, Lecture 111 Software Engineering, CPSC-4360-01, CPSC-5360-01,...

  • Slide 1

4/25/2015CPSC-4360-01, CPSC-5360-01, Lecture 111 Software Engineering, CPSC-4360-01, CPSC-5360-01, Lecture 11 Slide 2 4/25/2015 CPSC-4360-01, CPSC-5360-01, Lecture 11 2 Review of Last Lecture Implementing a Statechart Review of Java programming concepts Inheritance Polymorphism Type Casting Interface Slide 3 4/25/2015 CPSC-4360-01, CPSC-5360-01, Lecture 11 3 Overview of This Lecture Software Testing Overview Test Phases Unit Testing Integration Testing OO Specific Testing Automated Test Driver Overview Example Slide 4 4/25/2015 CPSC-4360-01, CPSC-5360-01, Lecture 11 4 Where are we now? Requirement Analysis Design Implement Test Evaluating the System Slide 5 4/25/2015 CPSC-4360-01, CPSC-5360-01, Lecture 11 5 Testing Famous Quotes Testing is the process of comparing the invisible to the ambiguous, so as to avoid the unthinkable happening to the anonymous., James BachJames Bach "Testing is organised skepticism., James BachJames Bach "Program testing can be used to show the presence of bugs, but never to show their absence!, Edgar DijkstraEdgar Dijkstra "Beware of bugs in the above code; I have only proved it correct, not tried it., Donald KnuthDonald Knuth Slide 6 4/25/2015 CPSC-4360-01, CPSC-5360-01, Lecture 11 6 Testing: Definitions 1. Testing is the process of establishing confidence that a program or system does what it is supposed to. 2. Testing is the process of executing a program or system with the intent of finding errors. 3. Testing is any activity aimed at evaluating an attribute or capability of a program or system and determining that it meets its required results. Slide 7 4/25/2015 CPSC-4360-01, CPSC-5360-01, Lecture 11 7 Testing: Overview 1. A software test process is based on well- defined software quality control and testing standards, testing methods, strategy, test criteria, and tools. 2. Engineers perform all types of software testing activities to perform a software test process. 3. The last quality checking point for software is on its production line. Slide 8 4/25/2015 CPSC-4360-01, CPSC-5360-01, Lecture 11 8 Testing: Objectives 1. Uncover as many errors (or bugs) as possible in a given time. 2. Demonstrate that a given software product matches its requirement specifications. 3. Generate high quality test cases, perform effective tests, and issue correct and helpful problem reports. Slide 9 4/25/2015 CPSC-4360-01, CPSC-5360-01, Lecture 11 9 Testing: Objectives 4. Uncover the errors (defects) in the software, including errors in: 1. requirements from requirement analysis. 2. design documented in design specifications. 3. coding (implementation). 4. system resources and system environment. 5. hardware problems and their interfaces to software. Slide 10 4/25/2015 CPSC-4360-01, CPSC-5360-01, Lecture 11 10 Testing: Personnel 1. Test Manager: 1. Manage, supervise, and control a software test project. 2. Define and specify a test plan. 2. Software Test Engineers and Testers: 1. Define test cases, write test specifications, run tests. 3. Development Engineers: 1. Only perform unit tests and integration tests. 4. Quality Assurance Group and Engineers: 1. Perform system testing. 2. Define software testing standards and quality control process. 5. Independent Test Group. Slide 11 4/25/2015 CPSC-4360-01, CPSC-5360-01, Lecture 11 11 Testing: Activities 1. Test Planning: 1. a test schedule for a test process and its activities, as well as assignments. 2. test requirements and items. 3. test strategy and supporting tools. 2. Test Design and Specification: 1. conduct software design based on well-defined test generation methods. 2. specify test cases to achieve a targeted test coverage. Slide 12 4/25/2015 CPSC-4360-01, CPSC-5360-01, Lecture 11 12 Testing: Activities 3.Test Set up: 1.Testing Tools and Environment Set-up. 2.Test Suite Set-up. 4.Test Operation and Execution: 1.Run test cases manually or automatically. 5.Test Result Analysis and Reporting: 1.Report software testing results and conduct test result analysis. 6.Problem Reporting: 1.Report program errors using a systematic solution. Slide 13 4/25/2015 CPSC-4360-01, CPSC-5360-01, Lecture 11 13 Testing: Activities 7.Test Management and Measurement: 1.Manage software testing activities, control testing schedule, measure testing complexity and cost. 8.Test Automation: 1.Define and develop software test tools. 2.Adopt and use software test tools. 3.Write software test scripts. 9.Test Configuration Management: 1.Manage and maintain different versions of software test suites, test environment and tools, and documents for various product versions. Slide 14 4/25/2015 CPSC-4360-01, CPSC-5360-01, Lecture 11 14 Testing: Cycle of Activities Testing usually involves repetition of testing activities. Example: Test Cases Perform Test Locate Error Design Error Repair Repair Error Test Results Specification retest Slide 15 4/25/2015 CPSC-4360-01, CPSC-5360-01, Lecture 11 15 Test Organization In 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. Slide 16 4/25/2015 CPSC-4360-01, CPSC-5360-01, Lecture 11 16 Testing Organization (V-Model) ProduceValidate Requirements specification System Specification System Design Module Design Coding Unit Testing Integration Testing System Testing Acceptance Testing User Specification System Specification Software Specification Module Specification ProduceValidate ProduceValidate Produce Validate Slide 17 4/25/2015 CPSC-4360-01, CPSC-5360-01, Lecture 11 17 Test Stage: Unit Test Testing 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. Slide 18 4/25/2015 CPSC-4360-01, CPSC-5360-01, Lecture 11 18 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. Slide 19 4/25/2015 CPSC-4360-01, CPSC-5360-01, Lecture 11 19 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 Slide 20 4/25/2015 CPSC-4360-01, CPSC-5360-01, Lecture 11 20 Example (Stub) Module A Stub B Stub C Stub D Stub B Print in B Return Module A Call Stub B Call Stub C Call Stub D Stub C Print in C Return Stub D Print in D Return Temporary Implementation Module Under Test Slide 21 4/25/2015 CPSC-4360-01, CPSC-5360-01, Lecture 11 21 Generating Unit Test Cases Statement coverage. Graph based: Branch coverage. Condition coverage. Path coverage. These are also applicable to testing methods within a class. Slide 22 4/25/2015 CPSC-4360-01, CPSC-5360-01, Lecture 11 22 Unit Testing: Object Oriented Code Class 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. Slide 23 4/25/2015 CPSC-4360-01, CPSC-5360-01, Lecture 11 23 Unit Testing: Object Oriented Code A 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. Slide 24 4/25/2015 CPSC-4360-01, CPSC-5360-01, Lecture 11 24 Unit Testing: Object Oriented Code For 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. Slide 25 4/25/2015 CPSC-4360-01, CPSC-5360-01, Lecture 11 25 Using Statechart Create test cases corresponding to each transition path that represent a full object life cycle. Make sure each transition is exercised at least once. Slide 26 4/25/2015 CPSC-4360-01, CPSC-5360-01, Lecture 11 26 Example ( Account from Lecture 10) statechart deposit [amt < -bal] /bal += amt Slide 27 4/25/2015 CPSC-4360-01, CPSC-5360-01, Lecture 11 27 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 once. Slide 28 4/25/2015 CPSC-4360-01, CPSC-5360-01, Lecture 11 28 Test Stage: Integration Testing The entire system is viewed as a collection of subsystems (sets of classes) determined during the system and object design. The order in which the subsystems are selected for testing and integration determines the testing strategy. It is carried out by the Development Engineer. A test that leads to construction of the complete software architecture. Slide 29 4/25/2015 CPSC-4360-01, CPSC-5360-01, Lecture 11 29