4 - blackbox testing

Upload: srhie3

Post on 03-Jun-2018

247 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/12/2019 4 - BlackBox Testing

    1/30

    Black

    BoxTesting

  • 8/12/2019 4 - BlackBox Testing

    2/30

    ?

  • 8/12/2019 4 - BlackBox Testing

    3/30

    ...a software testing techniquesin which

    functionality of the software under test (SUT)

    is tested without looking at the internal code structure,

    implementation details andknowledge of internal paths of the software.

    Black box testing is...

    This type of testing is based entirely on

    the software requirements and specifications.

  • 8/12/2019 4 - BlackBox Testing

    4/30

    ...on inputs and output

    of the software systemwithout bothering about

    internal knowledge

    of the software program

    FOCUS

  • 8/12/2019 4 - BlackBox Testing

    5/30

    STEPSInitially requirements and specifications

    of the system are examined

    Tester chooses valid inputs (positive test scenario),

    also some invalid inputs (negative test scenario)

    Tester determines expected outputsfor all those inputs

    Software tester constructs test cases

    with the selected inputs

    The test cases are executed

    Software tester compares the actual outputs

    with the expected outputs

    Defects if any are fixed and re-tested

  • 8/12/2019 4 - BlackBox Testing

    6/30

    TYPES...

    Functional Testing

    Black Box Testing

    Non-Functional

    Testing

  • 8/12/2019 4 - BlackBox Testing

    7/30

    Test Case

  • 8/12/2019 4 - BlackBox Testing

    8/30

    ...a set of test inputs, execution conditions, and expected results

    developed for a particular objective,

    such as to exercisea particular program path or

    to verifycompliance with a specific requirement

    Test caseis...

  • 8/12/2019 4 - BlackBox Testing

    9/30

    CASETESTUSE

    from

  • 8/12/2019 4 - BlackBox Testing

    10/30

  • 8/12/2019 4 - BlackBox Testing

    11/30

    Actors and Use cases

    in an ATM Machine

    This Use Case begins with the ATM in the Ready State.

    1. Initiate Withdraw - Customer inserts bank card in the card reader on the ATM machine

    2. Verify Bank Card - T he ATM reads the account code from the magnetic st rip on the bank card and checks if it is anacceptable bank card.

    3. Enter PIN - The ATM asks for the c ustomer's PIN code (4 digits)

    4. Verify account code and PIN - The account code and PIN are verified to determine if the account is valid and if the PIN

    entered is the correct PIN for the account. For this flow, the account is a valid account and the PIN is the correct PIN

    associated with this account.

    5. ATM Options - The ATM displays the different alternatives available at this ATM. In this flow, the bank customer always

    selects "Cash Withdraw."

    6. Enter Amount - The ATM the amount to withdraw. For this flow the customer selects a pre-set amount ($10, $20, $50,or $100).

    7. Authorization - The ATM initiates the verification process with the Banking System by sending the Card ID, PIN, Amount,

    and Account information as a transaction. For this flow, the Banking System is online and replies with the authorization to

    complete the cash withdrawal successfully and updates the account balance accordingly.

    8. Dispense - The Money is dispensed.

    9. Return Card - The Bank Card is returned.

    10. Receipt - The receipt is printed and dispensed. The ATM also updates the internal log accordingly.

    Use Case ends with the ATM in the Ready State.

    Basic Flow

  • 8/12/2019 4 - BlackBox Testing

    12/30

    Alternate Flow 1 - Not a

    valid Card

    In Basic Flow Step 2 - Verify Bank Card, if the card is not valid, it is ejected with an appropriate message.

    Alternate Flow 2 - ATM

    out of Money

    At Basic Flow Step 5 - ATM Options, if the ATM is out of money, the "Cash Withdraw" option will not be available.

    Alternate Flow 3 -

    Insufficient funds in ATM

    At Basic Flow Step 6 - Enter Amount, if the ATM contains insufficient funds to dispense the requested amount, an

    appropriate message will be displayed, and rejoins the basic flow at Step 6 - Enter Amount.

    At Basic Flow Step 4 - Verify Account and PIN, the customer has three tries to enter the correct PIN.

    If an incorrect PIN is entered, the ATM displays the appropriate message and if there are still tries remaining, this flow

    rejoins Basic Flow at Step 3 - Enter PIN.

    If, on the final try the entered PIN number is incorrect, the card is retained, ATM returns to Ready State, and this use case

    terminates.

    Alternate Flow 5 - No

    Account

    At Basic Flow Step 4 - Verify Account and PIN, if the Banking system returns a code indicating the account could not be

    found or is not an account which allows withdrawals, the ATM displays the appropriate message and rejoins the Basic Flow

    at Step 9 - Return Card.

    Alternate Flow 6 -

    Insufficient Funds in

    Account

    At Basic Flow Step 7 - Authorization, the Banking system returns a code indicat ing the account balance is less than the

    amount entered in Basic Flow Step 6 - Enter Amount, the ATM displays the appropriate message and rejoins the Basic F low

    at Step 6 - Enter Amount.

    Alternate Flow 7 - Daily

    maximum withdrawal

    amount reached

    At Basic Flow Step 6 - Authorization, the Banking system returns a code indicating that, including this request for

    withdrawal, the customer has or will have exceeded the maximum amount allowed in a 24 hour period, the ATM displays the

    appropriate message and rejoins the Basic F low at Step 6 - Enter Amount.

    Alternate Flow 4 -Incorrect PIN

    Alternate Flow...

  • 8/12/2019 4 - BlackBox Testing

    13/30

    CW1. Scenario 1 - Successful Cash Withdraw V V V V V Successful cash withdrawal.

    CW2. Scenario 2 - ATM out of Money V V V V I Cash Withdraw option

    unavailable, end of use caseCW3. Scenario 3 - Insufficient funds in ATM V V V V I Warning message, return to

    Basic Flow Step 6 - Enter

    Amount

    V Warning message, return to

    Basic Flow Step 4, Enter P IN

    CW6. Scenario 4 - Incorrect PIN (= 0 tries left) I V n/a V V Warning message, card

    retained, end of use case

    CW5. Scenario 4 - Incorrect PIN (= 1 try left) I V n/a V

    Expected Result

    CW4. Scenario 4 - Incorrect PIN (> 1 left) I V n/a V V Warning message, return to

    Basic Flow Step 4, Enter P IN

    Amount Entered

    (or chosen)TC ID# Scenario / Condition PIN Account #

    Amount in

    AccountAmount in ATM

    CW1. Scenario 1 - Successful Cash Withdraw 4987 809 - 498 50 500 2,000 Successful cash withdrawal. Account

    balance updated to 450.00

    CW2. Scenario 2 - ATM out of Money 4987 809 - 498 100 500 0 Cash Withdraw option unavailable,

    end of use case

    CW3. Scenario 3 - Insufficient funds in ATM 4987 809 - 498 100 500 70 Warning message, return to Basic

    Flow Step 6 - Enter Amount

    2,000 Warning message, return to Basic

    Flow Step 4, Enter PIN

    CW6. Scenario 4 - Incorrect PIN (= 0 tries left) 4978 809 - 498 n/a 500 2,000 Warning message, card retained,end of use case

    CW5. Scenario 4 - Incorrect PIN (= 1 try left) 4978 809 - 498 n/a 500

    Expected Result

    CW4. Scenario 4 - Incorrect PIN (> 1 left) 4978 809 - 498 n/a 500 2,000 Warning message, return to Basic

    Flow Step 4, Enter PIN

    Amount

    Entered

    (or chosen)

    TC

    ID#Scenario / Condition PIN

    Account

    #

    Amount in

    Account

    Amount in

    ATM

    Matrix Data Element

    Actual Data Values

  • 8/12/2019 4 - BlackBox Testing

    14/30

    Strategi pengujian yang hanya fokus kepada

    faktor fungsionalitas dan spesifikasi perangkat

    lunak.

    Testing dilakukan bukan pada awal proses

    pengujian, tapi pada beberapa tahap

    berikutnya

    14

  • 8/12/2019 4 - BlackBox Testing

    15/30

    Pengujian dirancang untuk menjawab beberapa

    pertanyaan sebagai berikut:1. Bagaimana validitas fungsionalnya diuji?

    2. Bagaimana perilaku sistem dan performansi diuji?

    3. Jenis inputseperti apa yang akan menghasilkan kasus uji yang baik ?

    4. Apakah sistem secara khusus sensitif terhadap nilai inputtertentu ?

    5. Bagaimana batasan-batasan kelas data diisolasi?

    6. Berapa rasio data dan jumlah data yang dapat ditoleransi oleh sistem?

    7. Apa akibat yang akan timbul dari kombinasi spesifik data pada operasi

    sistem?

    15

  • 8/12/2019 4 - BlackBox Testing

    16/30

    Menganalisis kebutuhan dan spesifikasi dari

    perangkat lunak.

    Pemilihan jenis inputyang memungkinkan

    menghasilkan outputbenar serta jenis input

    yang memungkinkan outputsalah pada

    perangkat lunak yang sedang diuji.

    Menentukan outputuntuk suatu jenis input.

    16

  • 8/12/2019 4 - BlackBox Testing

    17/30

    Pengujian dilakukan dengan input-inputyang

    telah benar-benar diseleksi.

    Melakukan pengujian.

    Pembandingan outputyang dihasilkan dengan

    outputyang diharapkan.

    Menentukan fungsionalitas yang seharusnyaada pada perangkat lunak yang sedang diuji.

    17

  • 8/12/2019 4 - BlackBox Testing

    18/30

    Black Box Testing dapat dilakukan pada setiap

    level pembangunan sistem

    18

  • 8/12/2019 4 - BlackBox Testing

    19/30

    Keunggulan

    Dapat memilih subset testyang secara efektif dan

    efisien dapat menemukan cacat.

    Dapat membantu memaksimalkan testing

    investment.

    Kelemahan

    Terdapat kemungkinan masih ada beberapa jalureksekusi yang belum pernah diuji oleh tester

    19

  • 8/12/2019 4 - BlackBox Testing

    20/30

    Equivalence Class Testing

    Teknik yang digunakan untuk mengurangi jumlah test caseyang ada pada saat pengujian. Kebanyakan testermenggunakan teknik yang simpel ini meskipun secaraformal tester tersebut tidak mengetahui mengenai metodedesain formal dalam pengujian perangkat lunak.

    Kasus uji yang didesain untuk Equivalence class testingberdasarkan pada evaluasi dari ekuivalensi jenis/class untukkondisi input.

    Class-class yang ekuivalen merepresentasikan sekumpulankeadaan valid dan invalid untuk kondisi input. Biasanyakondisi input dapat berupa spesifikasi nilai numerik, kisarannilai, kumpulan nilai yang berhubungan atau kondisiboolean.

  • 8/12/2019 4 - BlackBox Testing

    21/30

    Langkah-langkah

    Equivalence Class Testing

    Identifikasi kelas-kelas yang ekuivalen

    (equivalence class).

    Buat test caseuntuk tiap-tiap equivalence class.

    Jika memungkinkan buat test case tambahan yangacak yang memungkinkan ditemukannya cacat

    pada perangkat lunak.

  • 8/12/2019 4 - BlackBox Testing

    22/30

    Continuous

    equivalence classesContoh nilai untuk pendapatan/ salaryyang disyaratkan

    untuk melakukan pembelian rumah secara kredit:

  • 8/12/2019 4 - BlackBox Testing

    23/30

    Discrete

    equivalence classes

    Contoh nilai untuk jumlah kemilikan rumah yang disyaratkan

    untuk melakukan pembelian rumah secara kredit:

  • 8/12/2019 4 - BlackBox Testing

    24/30

    Single selection

    equivalence classes

    Contoh nilai untuk kategori pengajuan yang disyaratkan

    untuk melakukan pembelian rumah secara kredit:

  • 8/12/2019 4 - BlackBox Testing

    25/30

    Multiple selection

    equivalence classContoh nilai untuk jenis rumah yang disyaratkan untuk

    melakukan pembelian rumah secara kredit:

  • 8/12/2019 4 - BlackBox Testing

    26/30

    Boundary Value Testing

    Boundary value testing fokus kepada suatu

    batasan nilai dimana kemungkinan terdapat cacat

    yang tersembunyi.

    BVT mengarahkan pada pemilihan kasus uji yangmelatih nilai-nilai batas. BVT merupakan desain

    teknik kasus uji yang melengkapi Equivalence

    class testing. Dari pada memfokuskan hanya padakondisi input, BVA juga menghasilkan kasus uji

    dari domain output.

  • 8/12/2019 4 - BlackBox Testing

    27/30

    Langkah-langkah

    Boundary Value Testing

    Identifikasi kelas-kelas yang ekuivalen

    (equivalence class).

    Identifikasi batasan untuk tiap equivalence class.

    Buat test case untuk tiap batasan suatu nilaidengan memilih titik pada batasan, satu titik pada

    nilai bawah batasan dan satu titik pada nilai atas

    batasan.

  • 8/12/2019 4 - BlackBox Testing

    28/30

    Boundary values for a continuous

    range of inputs

    Tes data input untuk batas bawah adalah {$999, $1,000, $1,001} dan

    untuk batas atas {$83,332, $83,333, $83,334}.

    Contoh untuk nilai pendapatan/ salary:

  • 8/12/2019 4 - BlackBox Testing

    29/30

    Boundary values for a discrete range

    of inputs.

    Tes data input untuk batas bawah adalah {0, 1, 2} dan untuk batas atas {4,

    5, 6}.

    Contoh nilai untuk jumlah tempat tinggal (dwellings) yang dimiliki olehseseorang:

  • 8/12/2019 4 - BlackBox Testing

    30/30

    Contoh Kombinasi Pengujian

    Sangat penting untuk menginputkan nilai

    kombinasi secara besamaan, misalkan: