Softwaretesting 06 eng

37 1 0
Softwaretesting 06 eng

Đ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

ソフトウェアテスト    [6] ホワイトボックステス ト Software Testing [6] White Box Testing Techniques あまん ひろひさ ひろひさ 阿萬 裕久 裕久( AMAN Hirohisa ) aman@ehime-u.ac.jp (C) 2007-2022 Hirohisa AMAN Classification of tests  black box testing Explained in Part 4, Exercise in Session The contents of the program are not seen (black box), and operation tests are perfor med based on specifications  white box testing Perform operation tests based on the intern al structure (mainly flowchart)  random testing Create test cases randomly and test them (C) 2007-2022 Hirohisa AMAN white box test method  How to design test cases by focusing on the structure of the source program rat her than the specification  Test not in line with required specifications  Dealing with structural complexity (combin ation of conditions, etc.) in the source prog ram  Tests that supplement black box testing (C) 2007-2022 Hirohisa AMAN White box test method (1) Statement coverage method  Execute all statements at least once  It may not be possible with only one test c ase (execution path)  With different test cases, and consider thei r collection of test cases, It is possible to c over them all  The percentage of instructions that could b e executed is called the instruction covera ge rate  This is also known as C0 (C) 2007-2022 Hirohisa AMAN Example to test void foo(int x, int y){ int sum, n; sum = 0; for ( n = 0; n < x; n++ ){ sum += n; } if ( sum < y ){ printf("%dn", sum); } else{ printf("%dn", y); } } [input] Arguments x, y [output] Values printed by pr intf (C) 2007-2022 Hirohisa AMAN Instruction coverage example: x= 1,y=0 Source code Execution? void foo(int x, int y){ - int sum, n; ○ sum = 0; ○ for ( n = 0; n < x; n+ + ){ Instruction Coverage (C0) ○ ○ sum += n; } ○ if ( sum < y ){ printf("%dn", sum); } } else{ else{ printf("%dn", y); } } } } ☓ ← sum = (that‘s why) ○ - [Note] It is necessary to define in advance which instructions are counted as executable (C) 2007-2022 Hirohisa AMAN Example of 100% instruction cove 100% instruction cove instruction cove rage Source code x=1, y=0 x=1, y=1 total - - - int sum, n; ○ ○ ○ sum = 0; ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ☓ ○ ○ ○ ☓ ○ - - void foo(int x, int y){ for ( n = 0; n < x; n+ + ){ sum += n; } if ( sum < y ){ printf("%dn", sum); } } else{ else{ printf("%dn", y); } } } } (C) 2007-2022 Hirohisa AMAN When drawing a flowchart Test case ① x=1, y=0 START sum = F sum < y n=0 n

Ngày đăng: 26/07/2023, 21:58

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

  • Đang cập nhật ...

Tài liệu liên quan