Tải bản đầy đủ (.pptx) (19 trang)

Softwaretesting 07 eng

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (224.96 KB, 19 trang )

ソフトウェアテスト
   [7] ホワイトボックステス
ト演習
Software Testing
[7] White Box Testing Exercise & Seminar
あまん ひろひさ ひろひさ

阿萬 裕久 裕久( AMAN

Hirohisa )

(C) 2007-2022 Hirohisa AMAN

1


Exercise purpose
 Perform White Box Testing of the progra
m to experience and learn the importan
ce of software testing together with blac
k box testing
 Main contents





Checking instruction coverage using tools
Create a program according to specifications
Testing by others
Correction of the program


(C) 2007-2022 Hirohisa AMAN

2


Exercise content
 Exercise 1
Consider test cases for the given program (wit
h bugs) and check the instruction coverage (u
sing tools)

 Exercise 2
Create a prog ram according to the g iven speci
fications
and,
Have others test your prog ram
Modify the prog ram if any defects are found
(C) 2007-2022 Hirohisa AMAN

3


Using the file in
[5] Exercise

Exercise 1

Download from
Teams


[Test target] ex0501.c
① Run the test case created in [5] Exerci Exerci
se-1 (test-report0501.xlsx) to che
ck the instruction coverage with the t
ool, fill in test-report0701.xlsx
② If the instruction coverag e is not 10
0%, add more test cases (also add to
test-report0701.xlsx)
(C) 2007-2022 Hirohisa AMAN

4


Tools used in Exercise 1
 Use a tool (program) called g cov
 This is usually installed with g cc
 This tool examine the source and exec
utable files compiled with gcc and Rec
ord how many times each instruction is
executed

(C) 2007-2022 Hirohisa AMAN

5


g cov Usag e flow (1/7)
① First, compile the program with gcc
  however, add the option -coverage


gcc –coverage ex0501.c
② Then, run the program and test the first
test case
For example
• Parking time = 10
• Purchase = 0
(C) 2007-2022 Hirohisa AMAN

6


The instruction coverag e
rate is slig htly different
in Mac

g cov Usag e flow (2/7)

③ Next, use the gcov command to analyze
the execution result and map it with the s
Instruction
ource program
Coverag e is
displayed
(73.53%)

gcov ex0501.c
File 'ex0501.c'
Lines executed: 73.53% of
34
Creating ‘ex0501.c.gcov'

A file called
ex0501.c.gcov is created
that records the details
(C) 2007-2022 Hirohisa AMAN

7


Slig htly different in Mac

g cov Usag e flow (3/7)
④ Take a look at ex0501.c.gcov
Number of executions

Focus
on this

Below is
the
content
of the
prog ram

(C) 2007-2022 Hirohisa AMAN

8


Slig htly different in Mac


g cov Usag e flow (4/7)
Instruction Coverage Information

symbo
l

meaning

-

does not count as an instruction

numbe total number of executions of
rs
the line
#### not executing that line
#
(C) 2007-2022 Hirohisa AMAN

9


Slig htly different in Mac

g cov Usag e flow (5/7)
⑤ Next, run the second test case
For example
Parking time = -10 (to make an error)

⑥ Check with gcov again


gcov ex0501.c
File 'ex0501.c'
Lines executed: 79.41% of
34
Creating 'ex0501.c.gcov'
(C) 2007-2022 Hirohisa AMAN

The instruction
coverag e is
increasing
(73.53%→79.41%)79.41%)

10


Slig htly different in Mac

g cov Usag e flow (6/7)
⑦ View the contents of ex0501.c.gcov agai
n
The number of
executions has been
increased to 2

This part
is also
changing

(C) 2007-2022 Hirohisa AMAN


11


g cov Usag e flow (7/7)
 By repeating ⑤ to ⑦ , instruction covera
g e g radually increase (Note that is cum
ulative, However, the instruction covera
ge rate increases differs depending on t
he test cases.
[Note!] Exerci
If you recompile with gcc, the count of
executions will be reset, so be very careful

(C) 2007-2022 Hirohisa AMAN

12


test-report0701.xlsx

Test results in Exercise 1

A column for "Statement Coverag e" has been added to the
sheet of Exercise 1 of the 5th lession.
Copy the contents created in Ex1 of 5th lesson (testreport0501.xlsx) and fill in the instruction coverag e rate in
order from top to bottom.
Add test cases if it is not 100%
(chang e the color so that you can see the added line)
(C) 2007-2022 Hirohisa AMAN


13


Submission of Exercise 1
 Submit to Teams
test-report0701.xlsx

[7] Exercise-1 (white box testing)
 Submission deadline: Tomorrow (Apr.
11) 13:00 (Vietnam time)
          
(C) 2007-2022 Hirohisa AMAN

14


Exercise 2
 Complete the ex0702.c program
(prog ram specification spec0702.pd
f)
 Test your prog ram with others
ex0702.
c
program
C

Student A.
test results


Student B.

test-report0702.xlsx
(C) 2007-2022 Hirohisa AMAN

15


Steps of Exercise 2 (1/2)

Included in ex7materials.zip but
incomplete

 1. Make your own program ex0702.c ac
cording to specification spec0702.pdf
 2. Ask another student to test your progr another student to test your prog r
am
2-1) Fill in your name and tester’s name
on test-report0702.xlsx.
2-2) Send your ex0702.c and test-report
0702.xlsx to the tester.
(C) 2007-2022 Hirohisa AMAN

16


Steps of Exercise 2 (2/2)
 3. Test the program, enter the result into
test-report0702.xlsx, and return it to the
program creator.

 4. The prog rammer check another student to test your progrs the test result
s, corrects the prog ram if there is a bug , a
nd runs the test ag ain.
 5. The prog ram author submits the final v
ersion of ex0702.c and test-report0702.xl
sx to Teams.
(C) 2007-2022 Hirohisa AMAN

17


Submission of Exercise 2
 Submit to Teams
 ex0702.c (final version)
 test-report0702.xlsx

[7] Exercise-2 (white box testing)

 Submission deadline: Apr.17, 13:00 (VN)
yourself

C

ex0702.c

program
Student A.

test results


Student B.

test-report0702.xlsx
(C) 2007-2022 Hirohisa AMAN

18


In the next lecture, we will analyz
e data using R and RStudio.
 Notice: All students must use your PC
in the next week’s lesson.
 You must install R and RStudio on your
PC before the lesson.

(C) 2007-2022 Hirohisa AMAN

19



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×