software testing yonsei university 2 nd semester, 2014 woo-cheol kim
TRANSCRIPT
![Page 1: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/1.jpg)
Software Testing
Yonsei University2nd Semester, 2014
Woo-Cheol Kim
![Page 2: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/2.jpg)
Topics Covered System Testing Component Testing Test Case Design
![Page 3: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/3.jpg)
The Testing Process Component testing
Testing of individual program components Usually the responsibility of the component developer
(except sometimes for critical systems) Tests are derived from the developer’s experience
System testing Testing of groups of components integrated to create a
system or sub-system The responsibility of an independent testing team Tests are based on a system specification
![Page 4: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/4.jpg)
Defect Testing The goal of defect testing is to discover defects in
programs
A successful defect test is a test which causes a program to behave in an anomalous way
Tests show the presence not the absence of defects
![Page 5: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/5.jpg)
The Software Testing Process
![Page 6: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/6.jpg)
System Testing Involves integrating components to create a system or sub-
system
In an iterative development process, it is concerned with testing an increment to be delivered to the customer
In a waterfall process, it is concerned with testing the entire system
For most complex systems, there are two distinct phases Integration testing Release testing
![Page 7: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/7.jpg)
Integration Testing Involves building a system from its components and
testing the resultant system for problems that arise from component interactions
Top-down integration Develop the overall skeleton of the system first and then add
components to it
Bottom-up integration Integrate infrastructure components that provide common
services, such as network and database access, and then add the functional components
To simplify error localization, components should be integrated incrementally
![Page 8: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/8.jpg)
Incremental Integration Testing
![Page 9: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/9.jpg)
Release Testing The process of testing a release of a system that will be
distributed to customers
Primary goal is to increase the supplier’s confidence thatthe system meets its requirements
Release testing is usually black-box or functional testing Based on the system specification only Testers do not have knowledge of the system implementation
![Page 10: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/10.jpg)
Testing Guidelines Testing guidelines are hints for the testing team to help
them choose tests that will reveal defects in the system
Choose inputs that force the system to generate all error messages
Design inputs that cause buffers to overflow Repeat the same input or series of inputs numerous times Force invalid outputs to be generated Force computation results to be too large or too small
![Page 11: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/11.jpg)
Performance Testing Part of release testing may involve testing the emergent
properties of a system, such as performance and reliability
Performance tests usually involve planning a series of tests where the load is steadily increased until the system performance becomes unacceptable
![Page 12: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/12.jpg)
Stress Testing Exercises the system beyond its maximum design load.
Stressing the system often causes defects to come to light
Stressing the system tests failure behaviour.Systems should not fail catastrophically. Stress testing checks for unacceptable loss of service or data
Stress testing is particularly relevant to distributed systems that can exhibit severe degradation as a network becomes overloaded
![Page 13: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/13.jpg)
Component Testing Component or unit testing is the process of testing
individual components in isolation
It is a defect testing process so its goal is to expose faults in these components
There are different types of component that may be tested at this stage: Individual functions or methods within an object Object classes with several attributes and methods Composite components made up of several different objects
or functions. They have a defined interface that is used toaccess their functionality
![Page 14: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/14.jpg)
Object Class Testing Object class testing should include:
The testing in isolation of all operations associated with the object
The setting and interrogation of all attributes associated with the object
The exercise of the object in all possible states.This means that all events that cause a state change in the object should be simulated
Inheritance makes it more difficult to design object class tests as the information to be tested is not localized
![Page 15: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/15.jpg)
Interface Testing Objectives are to detect faults due to interface errors or
invalid assumptions about interfaces Particularly important for object-oriented development as
objects are defined by their interfaces
B
C
Testcases
A
![Page 16: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/16.jpg)
Interface Errors Interface misuse
A calling component calls some other component and makes an error in its use of its interface (e.g. parameters in the wrong order)
Interface misunderstanding A calling component misunderstands the specification of the
interface of the called component and makes assumptions about the behaviour of the called component
Timing errors The called and the calling components operate at different
speeds and out-of-date information is accessed
![Page 17: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/17.jpg)
Interface Testing Guidelines Design tests so that parameters to a called procedure are
at the extreme ends of their ranges
Always test pointer parameters with null pointers
Design tests which cause the component to fail
Use stress testing in message passing systems
In shared memory systems, vary the order in which components are activated
![Page 18: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/18.jpg)
Test Case Design Involves designing the test cases (inputs and outputs)
used to test the system
The goal of test case design is to create a set of tests that are effective in validation and defect testing
Design approaches Requirement-based testing Partition testing Structural testing
![Page 19: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/19.jpg)
Requirement-Based Testing A general principle of requirement engineering is that
requirements should be testable
Requirement-based testing is a validation testing technique where we consider each requirement individually and derive a set of tests for that requirement
![Page 20: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/20.jpg)
LIBSYS Requirements1. The user shall be able to search either all of the initial set
of databases or select a subset from it
2. The system shall provide appropriate viewers for the user to read documents in the document store
3. Every order shall be allocated a unique identifier (ORDER_ID) that the user shall be able to copy to the account’s permanent storage area
![Page 21: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/21.jpg)
Tests For LIBSYS Requirement 1
Initiate user searches for items that are known to be present and known not to be present, where the set of databases includes one database
Initiate user searches for items that are known to be present and known not to be present, where the set of databases includes two databases
Initiate user searches for items that are known to be present and known not to be present, where the set of databases includes more than two databases
Select one database from the set of databases and initiate user searches for items that are known to be present and known not to be present
Select more than one database from the set of databases and initiate user searches for items that are known to be present and known not to be present
![Page 22: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/22.jpg)
Partition Testing Input data and output results of a program usually fall
into a number of different classes that have common characteristics such as positive numbers, negative numbers, and menu selections
Programs normally behave in a comparable way for all members of a class
Because of this equivalent behaviour, these classes are sometimes called equivalent partitions or domains
Test cases should be chosen from each partition
![Page 23: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/23.jpg)
Equivalence Partitioning (1/2)
![Page 24: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/24.jpg)
Equivalence Partitioning (2/2)
![Page 25: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/25.jpg)
Search Routine Specification
procedure Search (Key : ELEM; T: SEQ of ELEM; Found : in out BOOLEAN; L : in out ELEM_INDEX);
Pre-condition-- the sequence has at least one elementT’FIRST <= T’LAST
Post-condition-- the element is found and is referenced by L(Found and T(L) = Key)
or -- the element is not in the sequence(not Found and
not (exists i, T’FIRST <= i <= T’LAST, T(i) = Key))
![Page 26: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/26.jpg)
Testing Guidelines (Sequences)
Test with sequences of zero length
Test with sequences which have only a single value
Use different sequences of different sizes in different tests
Derive tests so that the first, middle and last elements of the sequence are accessed
![Page 27: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/27.jpg)
Search Routine – Input Partitions
![Page 28: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/28.jpg)
Structural Testing (1/2) The tests are derived from knowledge of the software’s
structure and implementation
This testing is sometimes called ‘white-box’, ‘glass-box’ testing or ‘clear-box’ testing to distinguish it from black-box testing
Understanding the algorithm used in a component can help us identify further partitions and test cases
![Page 29: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/29.jpg)
Structural Testing (2/2)
![Page 30: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/30.jpg)
Path Testing (1/2) Path testing is a structural testing strategy whose
objective is to exercise every independent execution path through a component or a program
If every independent path is executed, then all statements in the component must have been executed at least once
Furthermore, all conditional statements are tested for both true and false cases
![Page 31: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/31.jpg)
Path Testing (2/2) The starting point for path testing is a program flow graph
that is a skeletal model of all paths through the program
A flow graph consists of nodes representing decisions and edges showing flow of control
The flow graph is constructed by replacing program control statements with equivalent diagrams
![Page 32: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/32.jpg)
Flow Graph For Binary Search
![Page 33: Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim](https://reader036.vdocuments.us/reader036/viewer/2022062517/56649ef95503460f94c0b3fd/html5/thumbnails/33.jpg)
Independent Paths 1, 2, 8, 9 1, 2, 3, 8, 9 1, 2, 3, 4, 5, 7, 2, … 1, 2, 3, 4, 6, 7, 2, … Test cases should be derived so that all of these paths are
executed A dynamic program analyzer may be used to check that
paths have been executed