Control flow testing
Download
1 / 12

Control Flow Testing - PowerPoint PPT Presentation


  • 118 Views
  • Uploaded on

Control Flow Testing. Software Quality. Eko Prasetyo Teknik Informatika Univ. Pembangunan Nasional Veteran Jawa Timur 2011. Basic Idea. Dua jenis statemen dasar dalam unit program adalah assignment statements dan conditional statements.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Control Flow Testing' - primo


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Control flow testing

Control Flow Testing

Software Quality

Eko Prasetyo

TeknikInformatika

Univ. Pembangunan Nasional Veteran JawaTimur

2011


Basic idea
Basic Idea

  • Duajenisstatemendasardalam unit program adalahassignment statements dan conditional statements.

  • Statemen assignment secaraeksplisitdirepresentasikanmenggunakansimbol assignment “=“,

    • seperti : x = 2*y, dimana x dan y are variables.

  • Condition adalahintidalam statement kondisi, seperti: if(), for() loop, while() loop, and goto.

    • Misal, dalam if(x! = y), kitamengujiketidaksamaan x dan y.

  • Pemanggilanfungsiadalahmekanismeuntukmemberikanabstraksidesain program.

    • Karenafungsimenerima input danmemberikan output, makasebuahfungsisebenarnyamenjalankanserangkaianstatemendarititikmasukansampaiketitikkeluaran.

    • Eksekusiserangkaianinstruksidarititikmasukketitikkeluardisebutdenganlintasan (path).


Lintasan path unit program
Lintasan (path) unit program

  • Sebuah unit program bisamempunyaisejumlah path, banyak, bahkantakterhinggajumlahnya.

  • Sebuah path dikarakteristikkandengansebuah input dansebuah output yang diharapkan.

  • Sebuahmasukanbisamemberikankeluaran yang berbedakarenalintasan yang dilaluijugaberbeda.

  • Semakinbanyakkemungkinanpengujian, akanmemberikankualitas unit yang lebihbaik.

  • Control flow testing, dilakukanoleh programmer.



Simbol control flow graph cfg
Simbol Control Flow Graph (CFG)


Contoh cfg
Contoh CFG

  • Unit program untukmenentukanbilanganterbesardari 3 bilangan.

  • Koding:

A, B, C

1

A, B, C

if A>B

if A>C

max = A

else

max = B

end

else

if B>C

max = B

else

max = C

end

2

T

F

A > B

3

4

A > C

B > C

T

F

T

F

7

8

5

6

max = A

max = C

max = B

max = C


A, B, C

1

Jalur yang mungkinterjadi

2

T

F

A > B

3

4

A > C

B > C

T

F

T

F

7

8

5

6

max = A

max = C

max = B

max = C

Input Domain danJalur yang mungkinterjadi



Latihan
Latihan

  • Jika A adalahbilangangenapmakakalikan A dengan 2, kemudianhitungjumlahdarikelipatan 5 untuk 2*A

  • Jika A adalahbilanganganjilmakakalikan A dengan 2 kemudianditambah 1, kemudianhitungjumlahdarikelipatan 10 untuk 2*A+1

  • Misal:

    • A= 2, B=2*A=4, H=1

    • A= 4, B = 2*A = 8, H = 2

    • A = 10, B = 2*A=20, H=4

    • A = 3, B = 2*A+1=7, H=1

    • A= 7, B = 2*A+1 = 15, H=2

    • A = 11, B = 2*A+1 = 23, H=3


Latihan

A = ?

sisa = A mod 2

H = 0

1

A = ?

sisa = A mod 2

H = 0;

if sisa == 0

B = 2*A

while B > 5

H = H+1

B = B - 5;

end while

else

B = 2*A+1

while B > 10

H = H+1

B = B - 10;

end while

End if

H = H+1

F

2

T

sisa == 0

4

3

B = 2*A

B = 2*A+1

5

6

B > 5

B > 10

F

F

T

T

7

9

H = H + 1

B = B - 5

H = H + 1

B = B - 10

10

H = H + 1


A = ?

sisa = A mod 2

H = 0

Input domain danJalur yang mungkinterjadi

1

F

2

T

sisa == 0

4

3

B = 2*A

B = 2*A+1

5

6

B > 5

B > 10

F

F

T

Pengujian

T

7

9

H = H + 1

B = B - 5

H = H + 1

B = B - 10

10

H = H + 1


A = ?

sisa = A mod 2

H = 0

Input domain danJalur yang mungkinterjadi

1

F

2

T

sisa == 0

4

3

B = 2*A

B = 2*A+1

5

6

B > 5

B > 10

F

F

T

Pengujian

T

7

9

H = H + 1

B = B - 5

H = H + 1

B = B - 10

10

H = H + 1


ad