PIF487 07 Software Testing

Embed Size (px)

Citation preview

  • 8/11/2019 PIF487 07 Software Testing

    1/41

    Didik Dwi

    Prasetya

    didik

    dwi

    @um.ac.id

    Software Testing

  • 8/11/2019 PIF487 07 Software Testing

    2/41

    Didik Dwi - Teknik Elektro UM

    Subbahasan

    Software Testing

    Software Testing Strategies

    Software Testing Techniques

    2

  • 8/11/2019 PIF487 07 Software Testing

    3/41

  • 8/11/2019 PIF487 07 Software Testing

    4/41

    Didik Dwi - Teknik Elektro UM

    Software Testing

    Definisi lain:

    Testing is the process of executing a

    program or system with the intent of

    finding errors (Myers, 1979)

    Testing is any activity aimed at evaluating

    an attribute or capability of a program or

    system and determining that it meets itsrequired results (Hetzel, 1983)

    4

  • 8/11/2019 PIF487 07 Software Testing

    5/41

    Didik Dwi - Teknik Elektro UM

    Software Testing Layers

    Strategi: mengintegrasikan metode

    perancangan kasus uji

    Metode: menggunakan metode pengujian

    5

    Methods

    Strategies

  • 8/11/2019 PIF487 07 Software Testing

    6/41

    Didik Dwi - Teknik Elektro UM

    Why Software Testing?

    Why is it important? To improve quality

    For verification and validation (V&V)

    For reliability estimation

    Pengujian menghabiskan 30% - 40% dari total

    effort (Pressman)

    Sommerville, 1992: Development efforts are

    typically distributed as follows:Specifications / Design 30% - 40%

    Implementation 15% - 30%

    Testing 25% - 50%

    6

  • 8/11/2019 PIF487 07 Software Testing

    7/41Didik Dwi - Teknik Elektro UM

    V & V

    Verification refers to the set of tasks that ensurethat software correctly implements a specific

    function.

    Validation refers to a different set of tasks that

    ensure that the software that has been built is

    traceable to customer requirements. Boehm

    [Boe81] states this another way:

    Verification: "Are we building the product right?" Validation: "Are we building the right product?"

    7

  • 8/11/2019 PIF487 07 Software Testing

    8/41Didik Dwi - Teknik Elektro UM

    Testing Objectives

    Pengujian adalah proses eksekusiprogram dengan tujuan menemukan

    kesalahan.

    Kasus uji yang baik adalah yang memilikipeluang besar menemukan as-yet-

    undiscovered error.

    Pengujian dikatakan berhasil bila dapatmengungkap kesalahan yang belum

    diketahui.

    8

  • 8/11/2019 PIF487 07 Software Testing

    9/41Didik Dwi - Teknik Elektro UM

    Testing Principles

    All tests should be traceable to customerrequirements.

    Tests should be planed long before testing begins.

    The Pareto principle (80-20 rule) applies tosoftware testing.

    Testing should begin in the small and progress

    toward testing in the large

    Exhaustive testing is not possible

    To be most effective, testing should be conducted

    by an independent third party

    9

  • 8/11/2019 PIF487 07 Software Testing

    10/41Didik Dwi - Teknik Elektro UM

    Terms

    Mistake, error, defect, bug, fault, failure?Mistake: aksi yang mengakibatkan

    kesalahan

    Error: mistake di dalam kode

    Defect: error setelah delivery

    Bug: defect yang diterima tim pengembang

    Fault: manifestasi dari kesalahan

    Failure: kegagalan akibat suatu kesalahan

    10

  • 8/11/2019 PIF487 07 Software Testing

    11/41Didik Dwi - Teknik Elektro UM

    Software Testing

    Software Testing Strategies

    Software Testing Techniques

    11

  • 8/11/2019 PIF487 07 Software Testing

    12/41Didik Dwi - Teknik Elektro UM

    Testing Strategy

    12

    unit test integrationtest

    validationtest

    systemtest

    SEPA 6th ed, Roger S. Pressman

  • 8/11/2019 PIF487 07 Software Testing

    13/41Didik Dwi - Teknik Elektro UM

    Testing Strategy

    13

    Un it test

    Integration

    test

    Validation

    test

    System

    testSystem engineer ing

    Requirements

    Software Design

    Code & Implementation

    V& V Targets

  • 8/11/2019 PIF487 07 Software Testing

    14/41

  • 8/11/2019 PIF487 07 Software Testing

    15/41

    Didik Dwi - Teknik Elektro UM

    Unit Testing

    15

    module

    to betested

    test cases

    results

    software

    engineer

  • 8/11/2019 PIF487 07 Software Testing

    16/41

    Didik Dwi - Teknik Elektro UM

    Unit Testing

    Module interfaces are tested for properinformation flow.

    Local data are examined to ensure that

    integrity is maintained.Boundary conditions are tested.

    Basis (independent) path are tested.

    All error handling paths should be tested.Drivers and/or stubs need to be developed

    to test incomplete software.

    16

  • 8/11/2019 PIF487 07 Software Testing

    17/41

    Didik Dwi - Teknik Elektro UM

    Integration Testing

    17

    Options:

    the big bang approach

    an incremental construction strategy

  • 8/11/2019 PIF487 07 Software Testing

    18/41

    Didik Dwi - Teknik Elektro UM

    Integration Testing

    Bottom-up integration

    18

    drivers are replaced one at atime, "depth first"

    worker modules are grouped intobuilds and integrated

    A

    B

    C

    D E

    F G

    cluster

  • 8/11/2019 PIF487 07 Software Testing

    19/41

    Didik Dwi - Teknik Elektro UM

    Integration Testing

    Top-down integration

    19

    top module is tested withstubs

    stubs are replaced one ata time, "depth first"

    as new modules are integrated,some subset of tests is re-run

    A

    B

    C

    D E

    F G

  • 8/11/2019 PIF487 07 Software Testing

    20/41

    Didik Dwi - Teknik Elektro UM

    Validation Test

    Focuses on visible user actions and userrecognizable outputs from the system

    Validation tests are based on the use-case

    scenarios

    20

  • 8/11/2019 PIF487 07 Software Testing

    21/41

    Didik Dwi - Teknik Elektro UM

    Acceptance Testing

    Making sure the software works correctly forintended user in his or her normal work

    environment.

    Alpha test: version of the complete software is tested by

    customer under the supervision of the developer at

    the developer's site

    Beta test: version of the complete software is tested by

    customer at his or her own site without the developer

    being present

    21

  • 8/11/2019 PIF487 07 Software Testing

    22/41

    Didik Dwi - Teknik Elektro UM

    System Test

    Recovery testing check the system's ability to recover from failures

    Security testing

    verifies that system protection mechanism prevent

    improper penetration or data alteration

    Stress testing

    program is checked to see how well it deals with abnormal

    resource demands (i.e., quantity, frequency, or volume)

    Performance testing

    designed to test the run-time performance of software,

    especially real-time software

    22

  • 8/11/2019 PIF487 07 Software Testing

    23/41

    Didik Dwi - Teknik Elektro UM

    Debugging

    Testing DebuggingDebugging: diagnostic process

    Debugging (removal of a defect) occurs as

    a consequence of successful testing.

    23

  • 8/11/2019 PIF487 07 Software Testing

    24/41

    Didik Dwi - Teknik Elektro UM

    Software Testing

    Software Testing Strategies

    Software Testing Techniques

    24

  • 8/11/2019 PIF487 07 Software Testing

    25/41

    Didik Dwi - Teknik Elektro UM

    Test Case

    25

    "Bugs lurk in cornersand congregate atboundaries ..."

    Boris Beizer

    OBJECTIVE

    CRITERIA

    CONSTRAINT

    to uncover errors

    in a complete manner

    with a minimum of effort and time

  • 8/11/2019 PIF487 07 Software Testing

    26/41

    Didik Dwi - Teknik Elektro UM

    Software Testing Methods

    26

    Methods

    Strategies

    white-box

    methods

    black-box

    methods

  • 8/11/2019 PIF487 07 Software Testing

    27/41

    Didik Dwi - Teknik Elektro UM

    White-Box Testing

    Disebut juga clear box testing, glass boxtesting, transparent box testing, atau

    structural testing.

    Pengujian untuk memperlihatkan carakerja dari produk secara rinci sesuai

    dengan spesifikasinya

    27

  • 8/11/2019 PIF487 07 Software Testing

    28/41

    Didik Dwi - Teknik Elektro UM

    White-Box Testing

    28

    ... our goal is to ensure that allstatements and conditions havebeen executed at least once ...

  • 8/11/2019 PIF487 07 Software Testing

    29/41

    Didik Dwi - Teknik Elektro UM

    Basis Path Testing

    Basis Path adalah teknik uji coba White-Box(Tom Mc Cabe).

    Basis Path: untuk mendapatkan kompleksitas

    lojik dari suatu prosedur dan menggunakanukuran ini sebagai petunjuk untuk

    mendefinisikan himpunan jalur yang akan

    diuji

    Cyclomatic Complexity: ukuran yang

    menunjukkan kompleksitas lojik suatu

    program

    29

  • 8/11/2019 PIF487 07 Software Testing

    30/41

    Didik Dwi - Teknik Elektro UM

    Basis Path Testing

    30

  • 8/11/2019 PIF487 07 Software Testing

    31/41

    Didik Dwi - Teknik Elektro UM

    Basis Path Testing

    31

    Flow graph

  • 8/11/2019 PIF487 07 Software Testing

    32/41

    Didik Dwi - Teknik Elektro UM

    Basis Path Testing

    Predicate node

    32

  • 8/11/2019 PIF487 07 Software Testing

    33/41

    Didik Dwi - Teknik Elektro UM

    Basis Path Testing

    Cyclomatic Complexity dapat diperolehdengan menghitung daerah yang dapat

    dibentuk oleh graph

    Path 1 : 1 11 Path 2 : 1 2 3 4 5 10 1 11

    Path 3 : 1 2 3 6 8 9 10 1 11

    Path 4 : 1 2 3 6 7 9 10 1 11

    33

  • 8/11/2019 PIF487 07 Software Testing

    34/41

    Didik Dwi - Teknik Elektro UM

    Basis Path Testing

    Cyclomatic Complexity V(G) dapat puladihitung dengan

    V (G) = (E N) + 2

    dimana :E = jumlah edge pada flowgraph

    N = Jumlah Node pada flowgraph

    Jadi, V(G) = (11 9) + 2 = 4

    34

  • 8/11/2019 PIF487 07 Software Testing

    35/41

    Didik Dwi - Teknik Elektro UM

    Basis Path Testing

    Cyclomatic Complexity juga dapat dihitungdengan rumus :

    V (G) = P + 1

    dimana P = jumlah predikat Node pada flowgraph

    Jadi, V (G) = 3 + 1

    = 4

    35

  • 8/11/2019 PIF487 07 Software Testing

    36/41

    Didik Dwi - Teknik Elektro UM

    Black-Box Testing

    36

    requirements

    eventsinput

    output

  • 8/11/2019 PIF487 07 Software Testing

    37/41

    Didik Dwi - Teknik Elektro UM

    Black-Box Testing

    Memperlakukan software sebagai kotakhitam

    Untuk mengetahui apakah semua fungsi

    perangkat lunak telah berjalan sesuaidengan kebutuhan fungsional yang telah

    didefinsikan.

    37

  • 8/11/2019 PIF487 07 Software Testing

    38/41

    Didik Dwi - Teknik Elektro UM

    Black-Box Testing

    How is system behavior and performance tested?What classes of input will make good test cases?

    Is the system particularly sensitive to certain input

    values?

    How is functional validity tested?

    How are the boundaries of a data class isolated?

    What data rates and data volume can the system

    tolerate?

    38

  • 8/11/2019 PIF487 07 Software Testing

    39/41

    Didik Dwi - Teknik Elektro UM

    Black-Box Testing

    Jenis:equivalence partitioning

    boundary value analysis

    all-pairs testing fuzz testing

    model-based testing

    traceability matrixexploratory testing and

    specification-based testing.

    39

    Whi B Bl k B

  • 8/11/2019 PIF487 07 Software Testing

    40/41

    Didik Dwi - Teknik Elektro UM

    White-Box vs Black-Box

    40

    Operations and

    Functions with I /O

    White-boxinterface

    input

    output

    I nternal logic, data, structur e

    output

    input

    interface

    operation

    Black-box

    C l i

  • 8/11/2019 PIF487 07 Software Testing

    41/41

    Conclusion

    Pengujian adalah proses menjalankanprogram dengan maksud untuk

    menemukan kesalahan (error) sebelum di-

    deliveryke pengguna.Layer/aktivitas: metode dan strategi

    Metode pengujian:

    White-Box Testing Black-Box Testing