Presentation is loading. Please wait.

Presentation is loading. Please wait.

程建群 博士 (Dr. Jason Cheng) 13522913536 2008 年 03 月 Software Engineering Part 08.

Similar presentations


Presentation on theme: "程建群 博士 (Dr. Jason Cheng) 13522913536 2008 年 03 月 Software Engineering Part 08."— Presentation transcript:

1 程建群 博士 (Dr. Jason Cheng) Jason_beihang@yahoo.cn 13522913536 2008 年 03 月 Software Engineering Part 08

2 Software Engineering 2007 - 2008 Software Testing

3 Software Engineering 2007 - 2008 Introduction Software testing is the execution of the software with actual test data. Sometimes it is called dynamic software testing to distinguish it from static analysis, which is sometimes called static testing. Static analysis involves analyzing the source code to identify problems. Although other techniques are very useful in validating software, actual execution of the software with real test data is essential. Software Testing

4 Software Engineering 2007 - 2008 Software Testing Fundamentals Exhaustive testing is the execution of every possible test case. Even simple systems have too many possible test cases. Thus, testing is always executing a very small percentage of the possible test cases. Software Testing

5 Software Engineering 2007 - 2008 Software Testing Fundamentals Tow basic concerns in software testing are: (1)What test cases to use (test case selection) and (2)How many test cases are necessary (stopping criterion). Software Testing

6 Software Engineering 2007 - 2008 Test Coverage Criterion Software Testing A test coverage criterion is a rule about how to select tests and when to stop testing. One basic issue in testing research is how to compare the effectiveness of different test coverage criteria. The standard approach is to use the subsumes relationship.

7 Software Engineering 2007 - 2008 Test Coverage Criterion Software Testing A test criterion A subsumes test coverage criterion B if any test set that satisfies criterion A also satisfies criterion B. This means that the test coverage criterion A somehow include the criterion B Subsumes

8 Software Engineering 2007 - 2008 Test Coverage Criterion Software Testing For example, if one test coverage criterion required every statement to be executed and another criterion required every statement to be executed and some additional tests, then the second criterion would subsume the first criterion. Subsumes

9 Software Engineering 2007 - 2008 Software Testing Fundamentals In functional testing, the specification of the software is used to identify subdomains that should be tested. All special cases should have a test case. Tricky situations should be tested. Common mistakes and misconceptions should be tested. The result should be s set of test cases that will thoroughly test the program when it is implemented. Software Testing Functional Testing

10 Software Engineering 2007 - 2008 Software Testing Fundamentals A way to formalize this identification of subdomains is to build a matrix using the conditions that we can identify from the specification and then to systematically identify all combinations of these conditions as being true or false. Software Testing Test Matrices

11 Software Engineering 2007 - 2008 Software Testing Fundamentals Structural testing is based on the structure of the source code. The simplest structural testing criterion is every statement coverage, often called C0 coverage. Software Testing Structural Testing

12 Software Engineering 2007 - 2008 Software Testing Fundamentals CO – Every Statement Coverage This criterion is that every statement of the source code should be executed by some test case. The normal approach to achieving C0 coverage is to select test cases until a coverage tool indicates that all statements in the code have been executed. Software Testing Structural Testing

13 Software Engineering 2007 - 2008 Software Testing Fundamentals The following pseudo code implements the triangle problem. The matrix shows which lines are executed by which test cases. Note that the first three statements (A, B, and C) can be considered parts of the same node. Software Testing Example 8.1

14 Software Engineering 2007 - 2008 Software Testing Fundamentals Software Testing Example 8.1

15 Software Engineering 2007 - 2008 Software Testing Fundamentals Software Testing Example 8.1 By the fourth test case, every statement has been executed. This set of test cases is not the smallest set that would cover every statement. However, finding the smallest test set would often not find a good test set.

16 Software Engineering 2007 - 2008 Software Testing Fundamentals Software Testing C1 – Every Branch Testing A more thorough test criterion is every-branch testing, which is often called C1 test coverage. In this criterion, the goal is to go both ways out of every decision. Structural Testing

17 Software Engineering 2007 - 2008 Software Testing Fundamentals Software Testing Every-Path Testing Even more thorough is the every-path testing criterion. A path is a unique sequence of program nodes that are executed by a test case. Structural Testing

18 Software Engineering 2007 - 2008 Software Testing Fundamentals Software Testing Multiple-Condition Coverage A multiple-condition testing criterion requires that each primitive relation condition is evaluated both true and false. Additionally, all combinations of T/F for the primitive relations in a condition must be tried. Structural Testing

19 Software Engineering 2007 - 2008 Software Development Methods

20 Software Engineering 2007 - 2008 Object-Oriented Development Software Development Methods Object-oriented software is different than conventional software. There are potentially many benefits to object-oriented development. Among these benefits are simplification of requirements, design, and implementation. Introduction

21 Software Engineering 2007 - 2008 Object-Oriented Development Software Development Methods These benefits are achieved by modeling the problem domain with objects that represent the important entities, by encapsulating the functions with the data, by reusing objects within a project and between projects, and by having a solution that is much closer intellectually to the problem. The Unified Modeling Language (UML) is the standard notation for object-oriented models. Introduction

22 Software Engineering 2007 - 2008 Object-Oriented Development Software Development Methods Inheritance comes from the recognition of the hierarchy of ideas and concepts, and how this hiearchy/classification involves much inherent reuse of ideas and so on from the higher-level concepts to the lower- level specialization of those concepts. Inheritance

23 Software Engineering 2007 - 2008 Object-Oriented Development Software Development Methods Example 8.1 Draw an object model that identifies all the commonalities between cars and vehicles. Next figure shows that cars and vehicles both have bodies, engines, wheels (maybe not four), headlights, brand names, manufacturer, and cost. Inheritance

24 Software Engineering 2007 - 2008 Object-Oriented Development Software Development Methods It refers to functions that can deal with different versions or forms of the object or parameter list. In object-oriented software, it often means a function that can deal with the base type or a derived type. In the car vehicle example, the base class will have polymorphic functions for tasks that all vehicles perform but may perform differently, such as turn corners. Each derived class will either use the base class function or provide a version that is suitable for the derived class. Polymorphism

25 Software Engineering 2007 - 2008 Object-Oriented Development Software Development Methods Example 8.2 Find the functions in the library problem that can be common for all of the items and the functions that will have to be specialized for the derived class. Common – Checkout and check in functions (except maybe for checkout limitations). Specialized – Cataloging functions will differ. Polymorphism

26 Software Engineering 2007 - 2008 Object-Oriented Development Software Development Methods A college wants a system that handles the courses, sections of courses, and students. Draw an object model and identify the associations between the objects. The college will need to access the students for printing out student information. To print out courses taken by students, there needs to be access from students to sections. To print out the line schedule that prints the sections that are available, there needs to be access to courses and then to sections for each course. Example 8.3

27 Software Engineering 2007 - 2008 Object-Oriented Development Software Development Methods Example 8.3

28 Software Engineering 2007 - 2008 Object-Oriented Development Software Development Methods Example 8.4 Use existence dependency to determine the association in the student section problem of last example. The object model developed in last example does not satisfy the existence dependency rules, since section cannot be existence dependent on student or vice versa. Thus, an additional object called enrollment must be used.

29 Software Engineering 2007 - 2008 Object-Oriented Development Software Development Methods Example 8.4


Download ppt "程建群 博士 (Dr. Jason Cheng) 13522913536 2008 年 03 月 Software Engineering Part 08."

Similar presentations


Ads by Google