1. Trang chủ
  2. » Giáo án - Bài giảng

Software Testing Structural Testing

30 225 0

Đ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

Thông tin cơ bản

Định dạng
Số trang 30
Dung lượng 13,41 MB

Nội dung

Structural Testing What is Structural Testing?  Based on Source Code  Examine the internal structure of the program  Test cases are derived from an examination of program‘s logic  Do not pay any attention to specification.  The knowledge to the internal structure of code can be used to find the number of test cases required to guarantee a given level of test coverage. Why Structural Testing is Required?  Part of code not fully exercised.  Section of code may be surplus to the requirements.  Errors may be missed by functional requirements. Levels of Coverage Levels of Coverage  1. Statement (Line) coverage  2. Decision (Branch) coverage  3. Condition coverage  4. Decision/Condition coverage  5. Multiple Condition coverage  6. Loop coverage  7. Path coverage Levels of Coverage Levels of Coverage Statement Coverage Statement Coverage Levels of Coverage Levels of Coverage Branch Coverage Branch Coverage Levels of Coverage Levels of Coverage Branch Coverage Branch Coverage Levels of Coverage Levels of Coverage Condition Coverage Condition Coverage  Condition coverage reports the true or false outcome of each boolean sub-expression, separated by logical-and and logical-or if they occur. Condition coverage measures the sub-expressions independently of each other. Levels of Coverage Levels of Coverage Decision/Condition Coverage  A hybrid metric composed by the union of condition coverage and decision coverage Levels of Coverage Levels of Coverage Multiple Condition Coverage [...]... times, exactly once, and more than once  Path Testing( 1)  Group of test techniques based on judicious selecting a set of test paths through the program  Most applicable to new software for module testing or unit testing  The effectiveness of path testing rapidly deteriorates as the size of the software under test increases Path Testing( 2) This type of testing involves: Generating a set of paths that... Generate test cases which are coverage independent path Data Flow Testing (1)  Data flow testing focuses on the points at which variables receive values and the points at which these values are used (or referenced) It detects improper use of data values due to coding errors Data Flow Testing (2)  Flow graph used as basic for data flow testing  Data flow analyses centered on a set of faults that are... along at least one edge that has not been traversed before the path is defined Path Testing Independent Path (2) A  Independent paths are: B C  ABGOQRS D  ABGOPRS F  ABCDFGOQRS E G  ABCDEFGOPRS O H  ABGHIJNRS I J P K L Q  ABGHIKLNRS M N R S  ABGHIKMNRS Path Testing Computation of cyclomatic complexity (1)  Structural Complexity  Given by McCabe  Used to find number of independent paths through... Path Testing Computation of cyclomatic complexity (2)  Cyclomatic complexity has a foundation in graph theory and is computed in the following ways:  1 V(G) = E – N + 2P E: number of edges N: number of nodes  2 V(G) = P + 1 P: number of predicate nodes  3 V(G)= number of region Path Testing Computation of cyclomatic complexity (3)  1 V(G)= E–N+2=?  2 V(G)= P + 1=?  3 V(G)= No regions= ? Path Testing. .. Path Testing DD Path Graph (1)  Decision to decision path graph  DD path graph is a directed graph in which nodes are sequences of statements and edges represent control flow between node  Used to find independent path Path Testing DD Path Graph (2) 7 8 9 10 11 12 A 13  Example: B 14 15 20 21 16 22 17 23 18 24 19 25 C 26 27 28 D 29 34 30 35 E 38 F 31 G 36 32 H 37 33 39 40 I J 41 42 K L Path Testing. .. defining node of v Data Flow Testing (4) Steps for Data Flow Testing Draw the program Flow graph Find the DD path graph Prepare the table for Def/Use status of all variable Find all du-path Identify du-path that are not dc-path Generate test cases to test all du-path at least one If we cannot test all du-paths, we have to test all du-paths that are not dc-path Data Flow Testing (5) Example  Consider... from node I to node J if the statement fragment corresponding to node J can be executed immediately after the statement fragment corresponding to node I Path Testing Flow Graph (2) Sequence If then else Repeat until loop While loop Case Path Testing Flow Graph (3)  Example: 3 3 begin Triangle (a, b, c: Integer): String 4 IsATriangle: Boolean begin 5 if (a

Ngày đăng: 12/05/2014, 11:09

TỪ KHÓA LIÊN QUAN