Title Layout
Subtitle
What is testing??
Black Box vs White Box?
Black Box Testing
• Unit Test adalah jenis black box testing,
menguji fungsionalitas program, sesuai atau
tidak dengan test case yang diharapkan.
• Contoh?
White Box Testing
• Control flow graph (CFG) menggambarkan segment-segment dari kode dan
urutan di antara segment kode tersebut dalam sebuah program serta memiliki
arah. CFG terdiri dari :
• Node : Mewakili segment kode
• Edge : Transfer control antar segment kode
• Entry node : Entri point dari suatu method, node yang tidak memilik edge masuk
• Exit node : Exit point dari suatu method, node yang tidak memilik edge keluar
• Decision node: Memiliki lebih dari satu edge keluar
• Junction node: Memiliki lebih dari satu edge masuk
• Processing node: Memilik satu edge masuk dan satu edge keluar
IF6125/MRPL/McCabeCCM 11/23/2022 16
• Segment Kode Proses Loop
• CFG Proses Loop
IF6125/MRPL/McCabeCCM
11/23/2022 17
CFG Statement Case dan Multiple-if
IF6125/MRPL/McCabeCCM 11/23/2022 18
CFG Switch Statements
IF6125/MRPL/McCabeCCM 11/23/2022 19
Contoh CFG sebuah method
Segment Kode
public boolean verify (String uid, String A
pwd) { boolean result =false;
int i = 0;
while ((result && (i < MAX)) B,C
==false) {
If ((userids[i]==uid) && D,E
(passwords[i] ==
pwd ))
result=true; F
++i; G
}
return result; H
}
IF6125/MRPL/McCabeCCM 11/23/2022 20
McCabe Cyclomatic Complexity
Merupakan software quality metric yang menghitung
kompleksitas dari suatu program /aplikasi.
Ditemukan oleh McCabe (1976).
Pengukuran McCabe cyclomatic complexity metric yang
berbasis graph ini mengasumsikan bahwa:
• Program dengan angka McCabe tinggi (misalnya> 10) cenderung sulit
• Memiliki probabilitas mengandung cacat yang lebih tinggi.
• Jumlah kompleksitas cyclomatic juga menunjukkan jumlah test case yang
harus diujikan dalam sebuah program
IF6125/MRPL/McCabeCCM 11/23/2022 21
Klasifikasi Kompleksitas
Klasifikasi kompleksitas menurut Software Engineering
Institute sebagai berikut:
IF6125/MRPL/McCabeCCM 11/23/2022 22
• atau
• Dimana :
• = Jumlah dari Edge (Transfer of control)
• = Jumlah Node (Kumpulan dari statament yang
bersifat sequential yang terdiri dari satu transfer of
control)
• = Jumlah bagain-bagian dari program yang tidak
saling terkoneksi (separate component), contohnya
pemanggilan program dan subroutine
Contoh 1
IF6125/MRPL/McCabeCCM 11/23/2022 24
Contoh Perhitungan Cyclomatic Complexity (CC)
• CC = 11 – 8 + 2(1)
• CC= 5
• CC = jumlah area tertutup +1 = 4+1 = 5
IF6125/MRPL/McCabeCCM 11/23/2022 25
Contoh Perhitungan Cyclomatic Complexity (CC)
• CC=E-N+2P
A
• CC=12-10+2(1)
• CC= 4 B C
• CC = jumlah area
D G
tertutup +1 = 3+1 = 4
E F
I
H
J
IF6125/MRPL/McCabeCCM 11/23/2022 26
Catatan
• Nilai CCM adalah nilai maksimum skenario pengujian
yang bisa dilakukan.
• Untuk melakukan white box testing bisa menggunakan
pengukuran lain selain dengan control flow graph
Tugas Kelompok
• Lakukan Black Box dan White Box Testing
pada tugas kelompok “Pizza”!
• (Dokumen Contoh terlampir)
Title and Content Layout with Chart
Series 1 Series 2 Series 3
4.4 4.5
4.3
3.5
3
2.8
2.4 2.5
2 2
1.8
Category 1 Category 2 Category 3 Category 4
Title and Content Layout with Table
• First bullet point here Class Group 1 Group 2
• Second bullet point here
Class 1 82 95
• Third bullet point here
Class 2 76 88
Class 3 84 90
Two Content Layout with SmartArt
• First bullet point here
Step 1 Title
• Second bullet point here
• Third bullet point here
Step 2 Title
Step 3 Title
Step 4 Title
CONTOH