6 - Software Testing

Embed Size (px)

Text of 6 - Software Testing

  • 7/30/2019 6 - Software Testing

    1/58

    Software testing

    Software Engineering 1

    1

  • 7/30/2019 6 - Software Testing

    2/58

    Objectives

    Software Engineering 1

    2

    To discuss the distinctions between validationtesting and defect testing

    To describe the principles of system and component

    testing To describe strategies for generating system test

    cases

    To understand the essential characteristics of tool

    used for test automation

  • 7/30/2019 6 - Software Testing

    3/58

    Topics covered

    Software Engineering 1

    3

    Introduction

    Black box and white box testing

    System testing

    Component testing Test case design

    Test automation

  • 7/30/2019 6 - Software Testing

    4/58

    Why Software Testing?

    The rocket self-destructed 37 seconds after launch Reason: A control software bug that went undetected

    Conversion from 64-bit floating point to 16-bit signed integer valuehad caused an exception

    The floating point number was larger than 32767 (max 16-bit signedinteger)

    Efficiency considerations had led to the disabling of the exceptionhandler.

    Program crashed rocket crashed

    Total Cost: over $1 billion

  • 7/30/2019 6 - Software Testing

    5/58

    Building Quality Software?

    Software Engineering 1

    5

    What Impacts the Software Quality? External Correctness Does it do what it suppose to do? Reliability Does it do it accurately all the time? Efficiency Does it do with minimum use of resources?

    Integrity Is it secure? Internal Portability Can I use it under different conditions? Maintainability Can I fix it? Flexibility Can I change it or extend it or reuse it?

    Quality Assurance The process of uncovering problems and improving the quality of

    software. Testing is a major part of QA.

  • 7/30/2019 6 - Software Testing

    6/58

    The testing process

    Software Engineering 1

    6

    Component testing

    Testing of individual program components;

    Usually the responsibility of the component developer (exceptsometimes for critical systems);

    Tests are derived from the developers experience. System testing

    Testing of groups of components integrated to create a system orsub-system;

    The responsibility of an independent testing team;

    Tests are based on a system specification.

  • 7/30/2019 6 - Software Testing

    7/58

    Testing phases

    Software Engineering 1

    7

  • 7/30/2019 6 - Software Testing

    8/58

    Defect testing

    Software Engineering 1

    8

    The goal of defect testing is to discover defects inprograms

    Asuccessfuldefect test is a test which causes a

    program to behave in an anomalous way Tests show the presence not the absence of defects

  • 7/30/2019 6 - Software Testing

    9/58

    Testing process goals

    Software Engineering 1

    9

    Validation testing

    To demonstrate to the developer and the system customer that thesoftware meets its requirements;

    A successful test shows that the system operates as intended.

    Defect testing To discover faults or defects in the software where its behaviour is

    incorrect or not in conformance with its specification;

    A successful test is a test that makes the system perform incorrectlyand so exposes a defect in the system.

  • 7/30/2019 6 - Software Testing

    10/58

    The software testing process

    Software Engineering 1

    10

  • 7/30/2019 6 - Software Testing

    11/58

    Testing policies

    Software Engineering 1

    11

    Only exhaustive testing can show a program is free fromdefects. However, exhaustive testing is impossible,

    Testing policies define the approach to be used in selectingsystem tests:

    All functions accessed through menus should be tested;

    Combinations of functions accessed through the same menu shouldbe tested;

    Where user input is required, all functions must be tested withcorrect and incorrect input.

  • 7/30/2019 6 - Software Testing

    12/58

    System testing

    Software Engineering 1

    12

    Involves integrating components to create a systemor sub-system.

    May involve testing an increment to be delivered tothe customer.

    Two phases: Integration testing - the test team have access to the system

    source code. The system is tested as components areintegrated.

    Mainly concerned with finding defects. Release testing test a version that could be delivered to users.

    The test team test the complete system to be delivered.

    Its usually a black-box testing; to demonstrate that the systemdoes or does not work properly.

  • 7/30/2019 6 - Software Testing

    13/58

    Integration testing

    Software Engineering 1

    13

    Involves building a system from its components andtesting it for problems that arise from componentinteractions.

    Top-down integration Develop the skeleton of the system and populate it with

    components.

    Bottom-up integration Integrate infrastructure components then add functional

    components. To simplify error localisation, systems should be

    incrementally integrated.

  • 7/30/2019 6 - Software Testing

    14/58

    Incremental integration testing

    Software Engineering 1

    14

    T3

    T2

    T1

    T4

    T5

    A

    B

    C

    D

    T2

    T1

    T3

    T4

    A

    B

    C

    T1

    T2

    T3

    A

    B

    Test sequence 1 Test sequence 2 Test sequence 3

  • 7/30/2019 6 - Software Testing

    15/58

    Testing approaches

    Software Engineering 1

    15

    Architectural validation Top-down integration testing is better at discovering errors in the

    system architecture.

    System demonstration

    Top-down integration testing allows a limited demonstration at anearly stage in the development.

    Test implementation Often easier with bottom-up integration testing.

    Test observation

    Problems with both approaches. Extra code may be required toobserve tests.

  • 7/30/2019 6 - Software Testing

    16/58

    Release testing

    Software Engineering 1

    16

    The process of testing a release of a system that willbe distributed to customers.

    Primary goal is to increase the suppliers confidencethat the system meets its requirements.

    Release testing is usually black-box or functionaltesting The system treated as black-box whose behaviour can be

    seen by the outputs generated from the input supplied.

    Tests are derived/based on the system specification only; Testers do not have knowledge of the system implementation.

  • 7/30/2019 6 - Software Testing

    17/58

    Black-box testing

    Software Engineering 1

    17

  • 7/30/2019 6 - Software Testing

    18/58

    Testing guidelines

    Software Engineering 1

    18

    Testing guidelines are hints for the testing team tohelp them choose tests that will reveal defects in thesystem Choose inputs that force the system to generate all error

    messages; Design inputs that cause buffers to overflow;

    Repeat the same input or input series several times;

    Force invalid outputs to be generated;

    Force computation results to be too large or too small.

  • 7/30/2019 6 - Software Testing

    19/58

    Testing scenario

    Software Engineering 1

    19

    A student in Scotland is studying A merican History and has been asked to write a paperon Frontier mentality in the American West from 1840 to 1880.To do this, she needs to

    find sources from a range o f libraries. She logs on to the LIBSYS system and uses thesearch facility to discover if she can acce ss original documents from that time. She

    discovers sources in various US university libraries and down loads copies of some ofthese. However, for one document, she needs to have confirmation from her university

    that she is a genu ine student and that use is for non-commercial purposes. The studentthen uses the facility in LIBSYS that can request such permission and registers her

    request. If granted, the document will be downloaded to the registered librarys server

    and printed for her. She receives a message f rom LIBSYS telling her that she will receivean e-mail message when th e printed document is available for collection.

  • 7/30/2019 6 - Software Testing

    20/58

    System tests

    Software Engineering 1

    20

    1. Test the login mechanism using correct and incorrect logins to checkthat valid users are accepted and invalid users are rejected.

    2. Test the search facility using diff erent queries against known sources tocheck that the search mechanism is actually finding documents.

    3. Test the system presentation facility to check that information aboutdocuments is displayed properly.

    4. Test the mechanism to request permission for downloading.5.

    Test the e-mail response indicating that the downloaded document isavailable.

  • 7/30/2019 6 - Software Testing

    21/58

    Use cases

    Software Engineering 1

    21

    Use cases can be a basis for deriving the tests for asystem. They help identify operations to be testedand help design the required test cases.

    From an associated sequence diagram, the inputsand outputs to be created for the tests can beidentified.

  • 7/30/2019 6 - Software Testing

    22/58

    Collect weather data sequence chart

    Software Engineering 1

    22

  • 7/30/2019 6 - Software Testing

    23