UNI ESING : WHIEBOX ESING email Addr Contact No : heriyanto.lucky@gmail.com : dewa_emas@yahoo.com : 08387003
Adalah testing yang diturunkan dari pengetahuan tentang struktur dan implementasi i program Nama lain : glass box, structural, clear box atau open box testing harus tahu secara detail tetang perangkat lunak yang akan di uji. Untuk pengujian yang lengkap maka suatu perangkat lunak harus diuji dengan white box dan black box testing Idealnya tim penguji mengikutsertakan programmer dari sistem yang akan diuji tersebut
Menguji setiap jalur independent Menguji keputusan logic (true atau falsa) Menguji Loops dan batasannya Menguji Data Struktur internalnya
White-box (or clear-box) testing implies having access to the code, being able to see it and review it. Static white-box testing is the process of carefully and methodically reviewing the software design, architecture, or code for bugs without executing it. It's sometimes referred to as structural analysis. he obvious reason to perform static white-box testing is to find bugs early and to find bugs that would be difficult to uncover or isolate with dynamic black-box testing. Having a team of testers concentrate their efforts on the design of the software at this early stage of development is highly cost effective.
ormal review adalah kegiatan diskusi/rapat dalam static white-box testing untuk mempelajari dan menguji desain, alur logika, dan kode program, yang dilakukan oleh tester dibantu oleh programmer. Identify Problems. he goal of the review is to find problems with the software not just items that are wrong, but missing items as well. All criticism should be directed at the design or code, not the person who created it. Participants shouldn't take any criticism personally. Leave your egos, emotions, and sensitive feelings at the door. ollow Rules. A fixed set of rules should be followed. hey may set the amount of code to be reviewed (usually a couple hundred lines), how much time will be spent (a couple hours), what can be commented on, and so on. his is important so that the participants know what their roles are and what they should expect. It helps the review run more smoothly. Prepare. Each participant is expected to prepare for and contribute to the review. Depending on the type of review, participants may have different roles. hey need to know what their duties and responsibilities are and be ready to actively fulfill them at the review. Most of the problems found through h the review process are found during preparation, not at the actual review. Write a Report. he review group must produce a written report summarizing the results of the review and make that report available to the rest of the product development team. It's imperative that others are told the results of the meeting how many problems were found, where they were found, and so on.
Ifthereviewsarerunproperly,theycanprovetobeagreatwaytofindbugs early. hink of them as one of the initial nets that catches the big bugs at the beginning gof the process. Sure, smaller bugs will still get through, but they'll be caught in the next testing phases with the smaller nets with the tighter weave.
Pembuatan testcase didasarkan pada alur logika Alur logika : cara dimana suatu bagian dari program tertentu dieksekusi saat menjalankan program. Alur logika dapat direpresentasikan dengan menggunakan flow graph
Komponen low graph : Nodes (titik) pernyataan (atau sub program) yang akan ditinjau saat eksekusi program. Edges (anak panah) jalur alur logika program untuk menghubungkan satu pernyataan (atau sub program) dengan yang lainnya. Branch nodes (titik cabang) titik-titik yang mempunyai lebih dari satu anak panah keluaran. Branch edges (anak panah cabang) anak panah yang keluar dari suatu titik cabang da suatu t t caba g Paths (jalur) jalur yang mungkin untuk bergerak dari satu titik ke lainnya sejalan dengan keberadaan arah anak panah.
Eksekusi suatu test case menyebabkan program untuk mengeksekusi pernyataanpernyataan tertentu, yang berkaitan dengan jalur tertentu, sebagaimana tergambar pada flow graph. Cakupan cabang, pernyataan dan jalur dibentuk dari eksekusi jalur program yang berkaitan dengan peninjauan titik, anak panah, dan jalur dalam flow graph.
Ditentukan dengan menilai proporsi dari pernyataan-pernyataan yang ditinjau i oleh sekumpulan test cases yang ditentukan. Cakupan pernyataan 00% jika tiap pernyataan pada program ditinjau setidaknya minimal sekali tes Cakupan pernyataan berkaitan dengan nodes dari suatu flowgraph
Pada contoh gambar flow graph di samping terdapat 0 titik. Misal suatu jalur eksekusi program melewati titik-titik A, B, D, H, K. Berarti ada 5 titik dari 0 titik yang dikunjungi, maka cakupan pernyataan sebesar 50%.
Cakupan cabang ditentukan dengan menilai proporsi dari cabang keputusan yang diuji oleh sekumpulan test cases yang telah ditentukan. Cakupan cabang 00% adalah bilamana tiap cabang keputusan pada program ditinjau setidaknya minimal sekali tes. Cakupan cabang berkaitan dengan peninjauan anak panah cabang (branch edges) dari flow graph.
Pada contoh gambar flow graph di samping, terdapat t 6 anak panah cabang. Misal suatu jalur eksekusi program melewati titik-titik A, B, D, H, K, maka jalur tersebut meninjau dari 6 anak panah cabang yang ada, jadi cakupannya sebesar 33 %.
Cakupan jalur ditentukan dengan menilai proporsi eksekusi jalur program yang diuji oleh sekumpulan test cases yang telah ditentukan. Cakupan jalur 00 % adalah bilamana tiap jalur pada program dikunjungi setidaknya minimal sekali tes. Cakupan jalur berkaitan dengan peninjauan jalur sepanjang flow graph.
Berdasarkan contoh flow graph di atas, terdapat 4 jalur. Bila suatu eksekusi jalur pada program melalui titik-titik A, B, D, H, K, maka eksekusi tersebut meninjau dari 4 jalur yang ada, jadi cakupannya sebesar 5%.
Untuk mendisain cakupan dari tes, perlu diketahui tahap-tahap sebagai berikut:. Menganalisa source code untuk membuat flow graph. gap. Mengidentifikasi jalur tes untuk mencapai pemenuhan tes berdasarkan pada flow graph. 3. Mengevaluasi kondisi tes yang akan dicapai dalam tiap tes. 4 M b ik il i k d k l 4. Memberikan nilai masukan dan keluaran berdasarkan pada kondisi.
Merupakan teknik white box testing yang dikenalkan oleh om McCabe [MC76]. Memungkinkan pendisain test cases untuk melakukan a pengukuran u terhadap kompleksitas logika dari disain prosedural Menggunakan ukuran kompleksitas tsb sebagai panduan dalam menentukan kelompok k basis dari jalur eksekusi dimana hal ini akan menjamin eksekusi tiap ppernyataan dalam program sekurangnya sekali selama testing berlangsung.
Identifikasi didasarkan pada jalur, struktur atau koneksi yang ada dari suatu sistem (branch testing), karena cabang-cabang dari kode atau fungsi logika diidentifikasi dan dites Konsep utama basis path : iap basis path harus diidentifikasi, tidak boleh ada yang terabaikan (setidaknya dites kali). Kombinasi dan permutasi dari suatu basis path tidak perlu dites.
Adalah pengukuran kuantitatif dari kompleksitas logika program. Pada konteks metode basis path testing, nilai yang dihitung bagi cyclomatic complexity menentukan jumlah jalur-jalur yang independen dalam kumpulan basis suatu program dan memberikan jumlah tes minimal yang harus dilakukan untuk memastikan bahwa semua pernyataan telah dieksekusi sekurangnya satu kali. Jalur independen adalah tiap jalur pada program yang memperlihatkan kelompok baru dari pernyataan proses atau kondisi baru. [Region / Complexity] V(G) = E (edges) N (nodes) +
public static int binarysearch( int key, int[] sequence ) { int bottom = 0; int top = sequence.length - ; int mid = 0; int keyposition = -; while( bottom <= top && keyposition == - ) { mid = ( top + bottom ) / ; if( sequence[ mid ] == key ) { keyposition = mid; if( sequence[ mid ] < key ) { bottom = mid + ; top = mid - ; return keyposition;
public static int binarysearch( int key, int[] sequence ) { int bottom = 0; int top = sequence.length - ; int mid = 0; int keyposition = -; while( bottom <= top && keyposition == - ) { mid = ( top + bottom ) / ; if( sequence[ mid ] == key ) { keyposition = mid; if( sequence[ mid ] < key ) { bottom = mid + ; top = mid - ; return keyposition;
public static int binarysearch( int key, int[] sequence ) { int bottom = 0; int top = sequence.length - ; int mid = 0; int keyposition = -; while( bottom <= top && keyposition == - ) { mid = ( top + bottom ) / ; if( sequence[ mid ] == key ) { keyposition = mid; if( sequence[ mid ] < key ) { bottom = mid + ; top = mid - ; return keyposition;
public static int binarysearch( int key, int[] sequence ) { int bottom = 0; int top = sequence.length - ; int mid = 0; int keyposition = -; while( bottom <= top && keyposition == - ) { mid = ( top + bottom ) / ; if( sequence[ mid ] == key ) { keyposition = mid; if( sequence[ mid ] < key ) { bottom = mid + ; top = mid - ; 0 return keyposition; 0
public static int binarysearch( int key, int[] sequence ) { int bottom = 0; int top = sequence.length - ; int mid = 0; int keyposition = -; 3 while( bottom <= top && keyposition == - ) { mid = ( top + bottom ) / ; if( sequence[ mid ] == key ) { keyposition = mid; if( sequence[ mid ] < key ) { bottom = mid + ; top = mid - ; 0 return keyposition; 0 3
public static int binarysearch( int key, int[] sequence ) { int bottom = 0; int top = sequence.length - ; int mid = 0; int keyposition = -; 3 while( bottom <= top && keyposition == - ) { mid = ( top + bottom ) / ; 4 if( sequence[ mid ] == key ) { 5 keyposition = mid; if( sequence[ mid ] < key ) { bottom = mid + ; top = mid - ; 0return keyposition; 0 3 4 5
public static int binarysearch( int key, int[] sequence ) { int bottom = 0; int top = sequence.length - ; int mid = 0; int keyposition = -; 3 while( bottom <= top && keyposition == - ) { mid = ( top + bottom ) / ; 4 if( sequence[ mid ] == key ) { 5 keyposition = mid; 6 if( sequence[ mid ] < key ) { bottom = mid + ; top = mid - ; 0 return keyposition; 0 3 4 6 5
public static int binarysearch( int key, int[] sequence ) { int bottom = 0; int top = sequence.length - ; int mid = 0; int keyposition = -; 3 while( bottom <= top && keyposition == - ) { mid = ( top + bottom ) / ; 4 if( sequence[ mid ] == key ) { 5 keyposition = mid; 6 if( sequence[ mid ] < key ) { bottom = mid + ; top = mid - ; 9 0 return keyposition; 0 3 4 6 5 9
public static int binarysearch( int key, int[] sequence ) { int bottom = 0; int top = sequence.length - ; int mid = 0; int keyposition = -; 3 while( bottom <= top && keyposition == - ) { mid = ( top + bottom ) / ; 4 if( sequence[ mid ] == key ) { 5 keyposition = mid; 6 if( sequence[ mid ] < key ) { bottom = mid + ; 7 top = mid - ; 9 0 return keyposition; 0 3 4 6 5 7 9
public static int binarysearch( int key, int[] sequence ) { int bottom = 0; int top = sequence.length - ; int mid = 0; int keyposition = -; 3 while( bottom <= top && keyposition == - ) { mid = ( top + bottom ) / ; 4 if( sequence[ mid ] == key ) { 5 keyposition = mid; 6 if( sequence[ mid ] < key ) { bottom = mid + ; 7 top = mid - ; 8 9 0 return keyposition; 0 3 4 6 5 8 7 9
public static int binarysearch( int key, int[] sequence ) { int bottom = 0; int top = sequence.length - ; int mid = 0; int keyposition = -; 3 while( bottom <= top && keyposition == - ) { mid = ( top + bottom ) / ; 4 if( sequence[ mid ] == key ) { 5 keyposition = mid; 6 if( sequence[ mid ] < key ) { bottom = mid + ; 7 top = mid - ; 8 9 0 return keyposition; 0 3 4 6 5 8 7 9
public static int binarysearch( int key, int[] sequence ) { int bottom = 0; int top = sequence.length - ; int mid = 0; int keyposition = -; 3 while( bottom <= top && keyposition == - ) { mid = ( top + bottom ) / ; 4 if( sequence[ mid ] == key ) { 5 keyposition = mid; 6 if( sequence[ mid ] < key ) { bottom = mid + ; 7 top = mid - ; 8 9 0 return keyposition; 0 3 4 6 5 8 7 9
public static int binarysearch( int key, int[] sequence ) { int bottom = 0; int top = sequence.length - ; int mid = 0; int keyposition = -; 3 while( bottom <= top && keyposition == - ) { mid = ( top + bottom ) / ; 4 if( sequence[ mid ] == key ) { 5 keyposition = mid; 6 if( sequence[ mid ] < key ) { bottom = mid + ; 7 top = mid - ; 8 9 0 return keyposition; 0 3 4 6 5 8 7 9
Setelah pembuatan flowgraph, tahap selanjutnya adalah 3 menghitung CC untuk menentukan jumlah jalur 4 independen 6 5 CC = jml edges-jml 8 7 nodes+ CC = 3-0+ = 5 0 9
Berdasarkan urutan alurnya, didapatkan suatu kelompok basis flow graph : Jalur = --0 Jalur = --3-0 Jalur 3 = --3-4-6-7-9--0 0 Jalur 4 = --3-4-6-8-9--0 Jalur 5 = --3-4-5-9--0 8 6 3 4 7 5 0 9
Buat flowgraph Hitung CC dan tentukan jalur independen Buatkan satu testcase berdasarkan jalur independen yang telah ditentukan
Buat flowgraph Hitung CC dan tentukan jalur independen Buatkan satu testcase berdasarkan jalur independen yang telah ditentukan public class actorial { // Evaluate n! public static long factorial( int n ) { if( n <= 0 ) // base case else return ; return n * factorial( n - ); // Simple test program public static void main( String [ ] args ) { ) ); for( int i = ; i <= 0; i++ ) System.out.println( factorial( i
Dynamic whitebox testing, adalah uji yang dilakukan dengan mengeksekusi kode program sesuai dengan testcase Nama lain dari dynamic whitebox testing adalah structural testing
Ada 4 area pengujian yang biasanya dilakukan dalam dynamic whitebox, yaitu: Mengeksekusi fungsi, prosedur, subrutin, atau library dari suatu soffware Mengeksekusi software secara utuh, dan fokus kepada operasi software yang utama Mengeksekusi software di kondisi/lingkungan berbeda sesuai testcase Menghitung baris kode yang dibutuhkan dalam setiap eksekusi berdasarkan testcase efisiensi dan kecepatan
ujuan dari dynamic whitebox testing adalah untuk menemukan bug, sedangkan tujuan dari debugging adalah untuk memperbaiki bug As a software tester, you should narrow down the problem to the simplest test case that demonstrates the bug. If it's white-box testing, that could even include information about what lines of code look suspicious. he programmer who does the debugging picks the process up from there, determines exactly what is causing the bug, and attempts to fix it.
Dalam dynamic whitebox testcase langkah pertama yang harus dilakukan adalah mendefinisikan modul-modul yang ada dalam software, dengan membuat diagram modul untuk mengetahui hubungan antar modul referensi dari fungsionalitas software (static blackbox testing)
langkah kedua yang harus dilakukan adalah mendefinisikan alur logika (flowgraph) kode program yang ada di dalam suatu modul tersebut Pada contoh sebelumnya, berdasarkan urutan alurnya didapatkan suatu kelompok basis flow graph (static whitebox testing): Jalur = --0 Jalur = --3-0 Jalur 3 = --3-4-6-7-9--0 Jalur 4 = --3-4-6-8-9--0 Jalur 5 = --3-4-5-9--0
Langkah ketiga buat testcase