IMSE Week 18 White Box or Structural Testing Reading:Sommerville (4th edition) ch 22 orPressman (4th edition) ch 16.

Slides:



Advertisements
Similar presentations
Chapter 14 Software Testing Techniques - Testing fundamentals - White-box testing - Black-box testing - Object-oriented testing methods (Source: Pressman,
Advertisements

Software Testing Technique. Introduction Software Testing is the process of executing a program or system with the intent of finding errors. It involves.
Defect testing Objectives
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
David Woo (dxw07u).  What is “White Box Testing”  Data Processing and Calculation Correctness Tests  Correctness Tests:  Path Coverage  Line Coverage.
CMSC 345, Version 11/07 SD Vick from S. Mitchell Software Testing.
Chapter 17 Software Testing Techniques
Software engineering for real-time systems
CS 425/625 Software Engineering Software Testing
Testing an individual module
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by.
Software Engineering Lecture 12 Software Testing Techniques 1.
Software Systems Verification and Validation Laboratory Assignment 3
Test plans CSCI102 - Systems ITCS905 - Systems MCS Systems.
CMSC 345 Fall 2000 Unit Testing. The testing process.
Testing phases. Test data Inputs which have been devised to test the system Test cases Inputs to test the system and the predicted outputs from these.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 20 Slide 1 Defect testing l Testing programs to establish the presence of system defects.
CSC 480 Software Engineering Lecture 14 Oct 16, 2002.
Software Reviews & testing Software Reviews & testing An Overview.
Agenda Introduction Overview of White-box testing Basis path testing
Software Testing. 2 CMSC 345, Version 4/12 Topics The testing process  unit testing  integration and system testing  acceptance testing Test case planning.
Testing Methods Carl Smith National Certificate Year 2 – Unit 4.
Software Testing Reference: Software Engineering, Ian Sommerville, 6 th edition, Chapter 20.
Testing Testing Techniques to Design Tests. Testing:Example Problem: Find a mode and its frequency given an ordered list (array) of with one or more integer.
Unit Testing 101 Black Box v. White Box. Definition of V&V Verification - is the product correct Validation - is it the correct product.
Black-box Testing.
INTRUDUCTION TO SOFTWARE TESTING TECHNIQUES BY PRADEEP I.
Software Testing Reference: Software Engineering, Ian Sommerville, 6 th edition, Chapter 20.
White-box Testing.
Software Testing and Reliability Southern Methodist University CSE 7314.
1 Program Testing (Lecture 14) Prof. R. Mall Dept. of CSE, IIT, Kharagpur.
Software Testing White Box Testing. Agenda What is White Box Testing Correctness Tests and Path Coverage Correctness Tests and Line Coverage McCabe Cyclomatic.
Software Engineering1  Verification: The software should conform to its specification  Validation: The software should do what the user really requires.
White Box Testing Arun Lakhotia University of Southwestern Louisiana P.O. Box Lafayette, LA 70504, USA
Software Construction Lecture 19 Software Testing-2.
CS451 Lecture 10: Software Testing Yugi Lee STB #555 (816)
Theory and Practice of Software Testing
SOFTWARE TESTING. Introduction Software Testing is the process of executing a program or system with the intent of finding errors. It involves any activity.
Agent program is the one part(class)of Othello program. How many test cases do you have to test? Reversi [Othello]
White Box Testing by : Andika Bayu H.
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by.
Software Testing Reference: Software Engineering, Ian Sommerville, 6 th edition, Chapter 20.
CSC 395 – Software Engineering Lecture 27: White-Box Testing.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
Verification vs. Validation Verification: "Are we building the product right?" The software should conform to its specification.The software should conform.
Defect testing Testing programs to establish the presence of system defects.
CHAPTER 9 - PART 2 Software Testing Strategies. Lesson Outlines ■ White box testing – Data processing and calculation correctness tests – Correctness.
1 Software Testing. 2 What is Software Testing ? Testing is a verification and validation activity that is performed by executing program code.
Testing Integral part of the software development process.
Software Engineering (CSI 321)
Chapter 17 Software Testing Techniques
Software TestIng White box testing.
Software Testing.
White-Box Testing Pfleeger, S. Software Engineering Theory and Practice 2nd Edition. Prentice Hall, Ghezzi, C. et al., Fundamentals of Software Engineering.
Software Testing.
Cyclomatic complexity
Software Engineering (CSI 321)
Chapter 13 & 14 Software Testing Strategies and Techniques
Structural testing, Path Testing
Types of Testing Visit to more Learning Resources.
White Box Testing.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Software Testing (Lecture 11-a)
Chapter 14 Software Testing Techniques
White-Box Testing Techniques I
Control Structure Testing
Software Testing “If you can’t test it, you can’t design it”
UNIT-4 BLACKBOX AND WHITEBOX TESTING
By: Lecturer Raoof Talal
Unit III – Chapter 3 Path Testing.
Presentation transcript:

IMSE Week 18 White Box or Structural Testing Reading:Sommerville (4th edition) ch 22 orPressman (4th edition) ch 16

White Box or Structural Testing l also known as glass box testing, each name implying that the internal structure of the program is visible, not hidden inside a black box l tester makes use of the implementation, analysing the source code to derive test cases l complements black box testing, white box test cases are added to the black box ones l provides a more comprehensive level of testing

Paths l program is inspected to determine the paths through it l a path is a way of getting from the start to the end of a program l test cases are selected which force execution through all/most/some of these paths l flow charts may be used to picture the paths through the program, showing sequences, selections and iterations l flow graphs are sometimes used, similar to flow charts but simpler l both are very useful for path testing, although not essential - simply inspecting the source code may be equally effective

An Example - the Pseudocode repeat input value if value is less than zero display “value is negative” else if value is greater than zero display “value is positive” else display “value is zero” 7 times

The Example as a Flowchart

The Example as a Flowgraph

No. of Paths l how many different ways are there of getting from the start to the end of our example program? l one way to find out is to –first number the boxes, diamonds and circles on the diagram –second, list their order of execution for each path through the program or module l for example, path 1 = 1,2,4,7,1,2,4,7,.....1,2,4,7,8

Selective Path Testing l in all non-trivial programs it is impossible to test all the paths through the program, especially when loops occur l instead do not test all paths, only take selected ones l aim to execute all statements at least once l all conditional statements must therefore be tested for both true and false cases l note that even though every statement may have been executed, a bug may not have been detected if it is only caused by a particular path combination

Basis Path Testing l method of selecting a comprehensive set of paths for testing l the paths selected using this method are all the independent paths i.e. those with some unique part l step 1 - determine how many independent paths there are l no. of independent paths = the cyclomatic complexity or V(G) of the module l cyclomatic complexity = no. of simple decisions + 1 or no. of enclosed areas + 1 l in our example above, V(G) =

Basis Path Testing (contd) l step 2 - now that we know how many independent paths there are, list them: l step 3 - derive test cases to exercise these paths l all conditions will be tested for both true and false l all loops will be executed at least once

Cyclomatic Complexity l useful software metric, measures the complexity of a module l the higher the V(G) the higher the probability of errors l a max V(G) of 10 is suggested for 1 module, above which adequate testing is extremely difficult l originated by Thomas McCabe who is also responsible for basis path testing l even though we know how many test cases are needed to execute every statement, identifying which test cases are needed may still be difficult l tools exist (e.g. dynamic program analysers) which keep track of those sections of a program that have been executed

White Box Testing of Loops minimum conditions to be tested for simple loops: l skip the loop entirely l only one pass through the loop l two passes through the loop if n is the maximum no. of allowable passes: l m passes through the loop, where m < n l (n - 1), n, and (n + 1) passes through the loop

White Box Testing of Data l do not concentrate solely on control flow, basis path testing and cyclomatic complexity in white box testing l data complexity should also be a major concern l e.g. a 7 element array containing the days of the week l the source code may access the array via a loop indexing the elements: loop exit when Days (i) = A; i = i + 1; end loop l this has a V(G) of 1, but needs at least 7 test cases

White Box versus Black Box l question: which strategy (if any) is better, white box or black box testing?

Advantages of Black Box Testing black box is better in that it discovers: l missing functions l functions which don’t correspond to the spec l weaknesses in the spec (e.g. “any integer” rather than to 32767) l interface errors between modules l performance weaknesses l initialisation errors l termination errors

Advantages of White Box Testing white box is better than black box in that: l it goes into a level of detail far beyond just looking at the output from a program, and is therefore clearly better than black box testing on individual small modules l it discovers extra non-specified functions that black box wouldn’t know to look for - such extras can only be discovered by inspecting the code (e.g. non-documented illegal options supplied by a disreputable programmer)

Conclusion l the list of advantages for black box testing looks more impressive but the first white box advantage concerning level of detail makes white box methods indispensable l but this level of detail has disadvantages, and black box becomes more relevant as modules are aggregated and become larger and larger l then we can’t think of path coverage and must be satisfied with simply determining that the product seems to do what we intended l answer: both are essential, they complement each other