SOFTWARE TESTING Software Engineering: A Practitioner's Approach -R.S. Pressman & Associates, Inc.
SONALI CHAUHAN SYBSC IT UDIT
INTRODUCTION
It is critical element of s/w quality assurance. S/w must be tested to uncover as many as errors before delivery to customer. This is where s/w testing technique comes into picture.
Software Testing
Sonali C.
2
CONT…
Technique provides systematic guidance for designing test:
Exercise internal logic of software components Exercise the i/p, o/p domain of program to uncover errors in program function, behavior and performance
S/w is tested in 2 perspective:
Internal logic of software components is exercise “WHITEBOX” test case technique S/w requirement are exercised using Software Testing C. “BLACKBOX” test Sonali case technique
3
CONT…
In both the cases, the intend is to find maximum number of error with minimum amount of effort and time.
Software Testing
Sonali C.
4
WHO TEST THE SOFTWARE???
independent tester
developer
Understands the system, but will test “gently” and, is driven by “delivery”
Software Testing
Sonali C.
Must learn about system but, will attempt to break it and, is driven by quality 5
TESTIBILITY FEATURE
OPERABILITY OBSERVABILITY CONTROLABILITY DECOMPOSABILITY SIMPLICITY STABILITY UNDERSTANDABILITY
Software Testing
Sonali C.
6
TESTING OBJECTIVE
Testing is a process of executing a program with the intent of finding an error. A good test case is one which has high probability to find an as-yetundiscovered error. A successful test is one that uncovers as-yet-undiscovered errors. Our objective is to design test that systematically uncover different classes of errors and to do so in minimum amount of time and efforts. If testing is conducted successfully it
Software Testing
Sonali C.
7
PRINCIPLE OF TESTING
Testability All tests should be traceable to customer requirement. Planning Tests should be planed long before testing begins. Execution Should begin in small and progress towards in the large.
Software Testing
Sonali C.
8
CONT…
Pareto The pareto principle: implies that 80% of all the errors uncovered during testing will likely be traceable to 20% of all programs components Exhaustive testing Exhaustive testing is not possible Moderation To be more effective testing should be conducted by a independent third party.
Software Testing
Sonali C.
9
TEST CASE DESIGN
Designing a test is difficult Recalling, test should be find max error in min efforts n time
Software Testing
Sonali C.
10
CONT…
Whitebox testing:
Knowing the internal working of the product, tests can be conducted to ensure that “all gears mesh”, i.e,internal operation are adequately exercised.
Blackbox testing
Knowing the specified function that a product has been designed to performed, tests can be conducted that demonstrate each function
Software Testing
Sonali C.
11
WHITEBOX TESTING
Close examination of procedural details. Goal is to ensure that all the conditions and statements are been executed at least once in loop. It is also known as ‘‘GLASS BOX TESTING’’
Software Testing
Sonali C.
12
CONT…
Software engineers can drive test cases that:
guarantee that all independent paths are within a module have been exercised at least once. Exercise all logical decision on their true and false sides Execute all loops at their boundaries and within their operational bound Exercise internal data structures to ensure their validity
Software Testing
Sonali C.
13
WHY WHITEBOX TESTING?
logic errors and incorrect assumptions are inversely proportional to a path's execution probability. we often believe that a logical path is not likely to be executed; in fact, it may be executed on a regular basis. Typographical errors are random; it's likely that untested paths will contain some
Software Testing
Sonali C.
14
CONT…
I.BASIC PATH TESTING
Basic path testing is white box testing It enables the test case design to derive a logical complexity basic of procedural design It contains following types
Flow graph notation Cyclomatic complexity Deriving test case
Software Testing
Sonali C.
15
1.Flow Graph Notation
It depicts the logical control flow of program
Software Testing
Sonali C.
16
2.CYCLOMATIC COMPLEXITY
Determines no of region of flow chart corresponds to CYCLOMATIC COMPLEXITY Cyclomatic complexity V(G)=E-N+2
E = no of flow graph edges N = number of flow graph nodes
V(G) = P+1
P=no of predicate node
Software Testing
Sonali C.
17
3.DERIVING TES CASE
Draw flow chart Determine CC Determine a basis set of linear independent path Prepare test cases which will execute each path in basic set.
Software Testing
Sonali C.
18
II. GRAPH MATRICES
A graph matrix is a square matrix whose size (i.e., number of rows and columns) is equal to the number of nodes on a flow graph Each row and column corresponds to an identified node, and matrix entries correspond to connections (an edge) between nodes. By adding a link weight to each matrix entry, the graph matrix can become a powerful tool for evaluating program control structure
Software Testing
Sonali C.
19
III. CONTROL STRUCTURE TESTING
Condition testing — a test case design method that exercises the logical conditions contained in a program module Data flow testing — selects test paths of a program according to the locations of definitions and uses of variables in the program
Software Testing
Sonali C.
20
IV. LOOP TESTING
Simple loop
Nested Loops Concatenated Loops
Software Testing
Sonali C.
Unstructured Loops 21
LOOP TESTING:SIMPLE LOOPS
Minimum conditions—Simple Loops skip the loop entirely only one pass through the loop two passes through the loop m passes through the loop m < n (n-1), n, and (n+1) passes through the loop where n is the maximum number of allowable passes
Software Testing
Sonali C.
22
LOOP TESTING:NESTED LOOPS
Nested Loop:
Start at the innermost loop. Set all outer loops to their minimum iteration parameter values. Test the min+1, typical, max-1 and max for the innermost loop, while holding the outer loops at their minimum values. Move out one loop and set it up as in step 2, holding all other loops at typical values. Continue this step until the outermost loop has been tested.
Software Testing
Sonali C.
23
Concatenated Loops If the loops are independent of one another then treat each as a simple loop else* treat as nested loops endif*
Software Testing
Sonali C.
24
BLACK BOX TESTING
Also called as Behavioral Testing Focuses on the functional requirements of S/W It is complimentary to whitebox testing that uncovers errors
Software Testing
Sonali C.
25
CONT…
Black-Box attempts to fin errors in following categories:
Incorrect or missing function Interface errors Errors in data structures or external data base access Behavior or performance errors Initialization and termination error
Software Testing
Sonali C.
26
CONT…
Black Box are designed to answer:
How is functional validity tested? 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 are the boundaries of a data class isolated? What data rates and data volume can the system tolerate? What effect will specific combinations of data have on system operation?
Software Testing
Sonali C.
27
CONT…
GRAPH BASE TESTING METHOD
To understand the objects that are modeled in software and the relationships that connect these objects Software testing begins by creating graph of object and relation among them to uncover errors. Graph is collection of nodes,links.
Software Testing
Sonali C.
28
CONT… Directed link (link weight)
object #1
object #2
Undirected link object # 3
Parallel links
Node weight (value )
(a)
new file
menu select generates (generation time < 1.0 sec)
is represented as
allows editing of
document window
Attributes:
contains background color: white text color: default color or preferences
document tex t (b)
Software Testing
Sonali C.
29
EQUIVALENCE PARTITIONING
Focuses on the test case for input condition
If as input condition specifies a range, 1-valid and 2-invalid equivalence class are define If as input condition specifies a value, 1-valid and 2-invalid equivalence class are define If as input condition specifies a number of a set, 1-valid and 1-invalid equivalence class are define
Software Testing
Sonali C.
30
BOUNDARY VALUE ANALYSIS
It selects test case at the edges of the class it focuses on input as well as output domain Guidelines for BVA are:
Software Testing
Sonali C.
31
CONT…
If the input condition specified a range bounded by values a and b, test case should be just above a and just below b. If the input condition specified a number of values, test case should be maximum and minimum Apply guideline 1 and 2 for output domain If internal program data structure have prescribed boundaries, design test case for data structure as its
Software Testing
Sonali C.
32
COMPARISON TESTING
Used only in situations in which the reliability of software is absolutely critical (e.g., human-rated systems)
Separate software engineering teams develop independent versions of an application using the same specification Each version can be tested with the same test data to ensure that all provide identical output Then all versions are executed in parallel with real-time comparison of results to ensure consistency Software Testing Sonali C. 33
ORTHOGANAL ARRAY TESTING
Used when the number of input parameters is small and the values that each of the parameters may take are clearly bounded
Software Testing
Sonali C.
34
TESTING STRATEGY
We begin by ‘testing-in-the-small’ and move toward ‘testing-in-the-large’ For conventional software The module (component) is our initial focus Integration of modules follows For OO software our focus when “testing in the small” changes from an individual module (the conventional view) to an OO class that encompasses attributes and operations and implies communication and collaboration
Software Testing
Sonali C.
35
CONT…
TESTING STRATEGY integration test
unit test
system test
Software Testing
validation test
Sonali C.
36
VALIDATION AND VERIFICATION
Software testing is one type of a broader domain that is known as verification and validation (V&V). Verification related to a set of operations that the software correctly implements a particular function. Validation related to a different set of activities that ensures that the software that has been produced is traceable to customer needs.
Software Testing
Sonali C.
37
UNIT TESTING module to be tested results software engineer
Software Testing
test cases
Sonali C.
38
CONT…
UNIT TESTING
Unit testing concentrates verification on the smallest element of the program. Control paths are tested to uncover errors within the boundary of module. Is whitebox oriented.
Software Testing
Sonali C.
39
CONT…
UNIT TESTING Interface Local Data Structure
… … MODULE … …
Boundary Condition Independent Paths Error Handling Paths
TEST CASES
Software Testing
Sonali C.
40
CONT…
UNIT TESTING
Module interface is tested to ensure that information properly flows into and out of the program unit being tested. Local data structure is tested to ensure that data stored temporarily maintains its integrity for all stages in an algorithm’s execution. Boundary conditions are tested to ensure that the modules perform correctly at boundaries created to limit or restrict processing. All independent paths through the control structure are exercised to ensure that all statements in been executed once.
Software Testing
Sonali C.
41
CONT…
UNIT TESTING-Environment Driver
Interface Local Data Structure Boundary Condition Independent Paths
Modules
Error Handling Paths
Stubs
Stubs
Result Software Testing
Sonali C.
TEST CASES 42
CONT…
UNIT TESTING-Procedure Once source code has been produced, reviewed, and verified for correct syntax, unit test case design can start. As a module is not a stand-alone program, driver and/stub software must be produced for each test units. Drivers are nothing more than “main program” that accepts test case, passes such information to the component (to be tested), and print relevant results. Stubs is “dummy subprogram” uses subordinate module interface ,may do minimal data manipulation, print verification of entry and Software Testing C. 43 returns controls to the Sonali modules undergoing
INTEGRATION TESTING
Once all the modules has been unit tested, Integration testing is performed. Next problem is Interfacing Data may lost across interface, one module may not have an adverse impact on another and a function is may not performed correctly when combined. IT is systematic testing. Produce tests to identify errors associated with interfacing.
Software Testing
Sonali C.
44
CONT…
INTEGRATION TESTING
The “big bang” approach. An entire program is tested as a whole creates a problem. An incremental construction strategy
Software Testing
Sonali C.
45
CONT…
INTEGRATION TESTINGTop Down Testing
Top-down integration is an incremental approach. Modules are integrated by moving downwards through the control hierarchy, starting with the main control module. Modules subordinate to the main control module are included into the structure in either a depth-first or breadth-first manner.
Software Testing
Sonali C.
46
CONT…
INTEGRATION TESTINGTop Down Testing
For instance in depth-first integration, selecting the left-hand path, modules M1, M2, M5 would be integrated first. Next M8 or M6 would be integrated. Then the central and right-hand control paths are produced. Breath-first integration includes all modules directly subordinate at each level, moving across the structure horizontally. From the figure modules M2, M3 and M4 would be integrated first. The M5, M6 etc., follows. Software Testing next control level, Sonali C. 47
CONT…
INTEGRATION TESTINGTop Down Testing M1 Top module is tested with stub
M2
M5
M9
Software Testing
M3
M6
M7
M4
stubs are replaced one at a time, "depth first"
M8
as new modules are integrated, some subset of tests is re-run
Sonali C.
48
CONT…
INTEGRATION TESTINGTop Down Testing
The integration process is performed in a series of five stages: The main control module is used as a test driver and stubs are substituted for all modules directly subordinate to the main control module. Depending on the integration technique chosen, subordinate stubs are replaced one at a time with actual modules. Tests are conducted as each module is integrated. On the completion of each group of tests, another stub is replaced with the real module. Software Testing Sonali C. 49 Regression testing may be performed to ensure
CONT…
INTEGRATION TESTINGTop Down Testing
Problem on Top Down Processing at low levels in the hierarchy is required to test upper level Solution Delay test until stubs are replaced with actual module
Develop stubs that perform limited functions to simulate actual module
Difficult to determine cause of errors
Overhead, as stubs become more compels.
Integrate software from bottom of the hierarchy
Software Testing
Sonali C.
50
CONT…
INTEGRATION TESTINGBottom Up Testing
Begins testing with the modules at the lowest level (atomic modules). As modules are integrated bottom up, processing required for modules subordinates to a given level is always available and the need for stubs is eliminated.
Software Testing
Sonali C.
51
CONT…
INTEGRATION TESTINGBottom Up Testing
A bottom-up integration strategy may be implemented with the following steps: Low-level modules are combined into clusters that perform a particular software subfunction. A driver is written to coordinate test cases input and output. The cluster is tested. Drivers are removed and clusters are combined moving upward in the program structure.
Software Testing
Sonali C.
52
CONT…
Software Testing
INTEGRATION TESTINGBottom Up Testing
Sonali C.
53
REGRESSION TESTING
Any time changes are made at any level, all previous testing must be considered invalid can do regression testing at unit, integration, and system level this means tests must be re-run to ensure the software still passes re-running previous tests is regression testing particularly problematic for user interface software
Software Testing
Sonali C.
54
SMOKE TESTING
A common approach for creating “daily builds” for product software. Smoke testing steps:
Software Testing
Sonali C.
55
SMOKE TESTING Software components that have been translated into code are integrated into a “build.” A build includes all data files, libraries, reusable modules, and engineered components that are required to implement one or more product functions. A series of tests is designed to expose errors that will keep the build from properly performing its function. The intent should be to uncover “show stopper” errors that have the highest likelihood of throwing the software project behind schedule. The build is integrated with other builds and the entire product (in its current form) is smoke Software Testing Sonali C. 56 tested daily.
VALIDATION TESTING
Software is completely assembled as a package, interfacing errors have been identified and corrected, and a final set of software tests validation testing are started. Validation can be defined in various ways, but a basic one is valid succeeds when the software functions in a fashion that can reasonably expected by the customer.
Software Testing
Sonali C.
57
CONT…
VALIDATION TESTING
Validation Test Criteria Configuration review Alpha and Beta testing
Software Testing
Sonali C.
58
SYSTEM TESTING
System testing is a series of different tests whose main aim is to fully exercise the computer-based system Although each test has a different role, all work should verify that all system elements have been properly integrated and form allocated functions. Below we consider various system tests for computer-based systems.
Software Testing
Sonali C.
59
CONT…
SYSTEM TESTING
Recovery Testing Recovery testing is a system test that forces the software to fail in various ways and verifies the recovery is performed correctly. Security Testing Security testing tries to verify that protection approaches built into a system will protect it from improper penetration. Stress Testing Stress testing executes a system in the demands resources in abnormal quantity
Software Testing
Sonali C.
60
Example of Stress testing most systems have requirements for performance under load, e.g., 100 hits per second 500 ambulances dispatched per day all data processed using 70% processor capacity while operating in flight mode with all sensors live systems with load requirements must be tested under load simulated load scenarios must be designed and supported frequently requires significant test code and equipment to adequately support
Software Testing
Sonali C.
61
PERFORMANCE TESTING
Test the runtime performance of the s/w within he context of integrated system.
Software Testing
Sonali C.
62
Thank You Any Doubt, question, query????