1 Static Testing: defect prevention SIM3302. 2 objectives Able to list various type of structured group examinations (manual checking) Able to statically.

Slides:



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

Unit-V testing strategies and tactics.
DATAFLOW TESTING DONE BY A.PRIYA, 08CSEE17, II- M.s.c [C.S].
Verification and Validation
Semantics Static semantics Dynamic semantics attribute grammars
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
Software Quality Assurance Inspection by Ross Simmerman Software developers follow a method of software quality assurance and try to eliminate bugs prior.
Testing Without Executing the Code Pavlina Koleva Junior QA Engineer WinCore Telerik QA Academy Telerik QA Academy.
Detailed Design Kenneth M. Anderson Lecture 21
©Ian Sommerville 2000Software Engineering, 6th edition. Chapter 19Slide 1 Verification and Validation l Assuring that a software system meets a user's.
Software Testing and Quality Assurance
Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas.
Chapter 18 Testing Conventional Applications
Unit Testing CS 414 – Software Engineering I Don Bagert Rose-Hulman Institute of Technology January 16, 2003.
 QUALITY ASSURANCE:  QA is defined as a procedure or set of procedures intended to ensure that a product or service under development (before work is.
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 5 Data Flow Testing
1 Software Testing Techniques CIS 375 Bruce R. Maxim UM-Dearborn.
1CMSC 345, Version 4/04 Verification and Validation Reference: Software Engineering, Ian Sommerville, 6th edition, Chapter 19.
Path testing Path testing is a “design structural testing” in that it is based on detailed design & the source code of the program to be tested. The methodology.
Testing Dr. Andrew Wallace PhD BEng(hons) EurIng
A Complexity Measure THOMAS J. McCABE Presented by Sarochapol Rattanasopinswat.
Cyclomatic Complexity Dan Fleck Fall 2009 Dan Fleck Fall 2009.
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
ECE355 Fall 2004Software Reliability1 ECE-355 Tutorial Jie Lian.
CSCI 5801: Software Engineering
Software Testing Verification and validation planning Software inspections Software Inspection vs. Testing Automated static analysis Cleanroom software.
©Ian Sommerville 2000Software Engineering, 6th edition. Chapter 19Slide 1 Verification and Validation l Assuring that a software system meets a user's.
1 ECE 453 – CS 447 – SE 465 Software Testing & Quality Assurance Instructor Kostas Kontogiannis.
Topics in Software Dynamic White-box Testing Part 2: Data-flow Testing
Objectives Understand the basic concepts and definitions relating to testing, like error, fault, failure, test case, test suite, test harness. Explore.
CS 501: Software Engineering Fall 1999 Lecture 16 Verification and Validation.
Presented By Dr. Shazzad Hosain Asst. Prof., EECS, NSU
CMSC 345 Fall 2000 Unit Testing. The testing process.
Prof. Mohamed Batouche Software Testing.
Software Inspection A basic tool for defect removal A basic tool for defect removal Urgent need for QA and removal can be supported by inspection Urgent.
Chapter 13: Implementation Phase 13.3 Good Programming Practice 13.6 Module Test Case Selection 13.7 Black-Box Module-Testing Techniques 13.8 Glass-Box.
Software Testing The process of operating a system or component under specified conditions, observing and recording the results, and making an evaluation.
Testing. 2 Overview Testing and debugging are important activities in software development. Techniques and tools are introduced. Material borrowed here.
Unit Testing 101 Black Box v. White Box. Definition of V&V Verification - is the product correct Validation - is it the correct product.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 22 Slide 1 Software Verification, Validation and Testing.
Static Program Analyses of DSP Software Systems Ramakrishnan Venkitaraman and Gopal Gupta.
Unit III Static Testing. static testing Testing of a component or system at requirements or implementation level without execution of any software, e.g.,
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.
1 Control Flow Analysis Topic today Representation and Analysis Paper (Sections 1, 2) For next class: Read Representation and Analysis Paper (Section 3)
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]
Static Techniques for V&V. Hierarchy of V&V techniques Static Analysis V&V Dynamic Techniques Model Checking Simulation Symbolic Execution Testing Informal.
FUNCTIONS. Midterm questions (1-10) review 1. Every line in a C program should end with a semicolon. 2. In C language lowercase letters are significant.
1 Phase Testing. Janice Regan, For each group of units Overview of Implementation phase Create Class Skeletons Define Implementation Plan (+ determine.
Politehnica University of Timisoara Mobile Computing, Sensors Network and Embedded Systems Laboratory Embedded Systems Testing Static Techniques instructor:
Testing Overview Software Reliability Techniques Testing Concepts CEN 4010 Class 24 – 11/17.
CS223: Software Engineering Lecture 21: Unit Testing Metric.
What is a software? Computer Software, or just Software, is the collection of computer programs and related data that provide the instructions telling.
Software Dynamic White-box Testing Part 2: Data-flow Testing Lecture 7 Prof. Mostafa Abdel Aziem Mostafa.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
CX Introduction to Web Programming Testing.
PREPARED BY G.VIJAYA KUMAR ASST.PROFESSOR
SOFTWARE TESTING Date: 29-Dec-2016 By: Ram Karthick.
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.
Software Engineering (CSI 321)
Structural testing, Path Testing
Types of Testing Visit to more Learning Resources.
STATIC TESTING. Topics to be covered I. Static Testing: 1. Structured Group Examinations- Reviews II. Static Analysis: 1.
Software Testing (Lecture 11-a)
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Software Testing “If you can’t test it, you can’t design it”
Software Testing and QA Theory and Practice (Chapter 5: Data Flow Testing) © Naik & Tripathy 1 Software Testing and Quality Assurance Theory and Practice.
Presentation transcript:

1 Static Testing: defect prevention SIM3302

2 objectives Able to list various type of structured group examinations (manual checking) Able to statically analyse program code using compilers, data flow analysis, and control flow analysis

3 Structured Group Examination Systematic use of human capability to think and analyse –Apply human analytical capability to check and evaluate complex issues –This done by through intensive reading and trying to understand the documents that are examined –Techniques : Reviews –Another terms : inspection –Peer reviews : if colleagues provide feedback –Types of reviews Walkthrough Inspection Technical review Informal review You will learn in software quality course SIM4306

4 Static analysis What is static analysis? –Analysis of software artifacts e.g., requirements or code, carried out without execution of these software artifacts Objective of static analysis –To reveal defects or parts that are defect-prone in a document –Additional objective To derive metrics in order to measure and prove the quality of the object How is static analysis done? –Static analysis tools known as static analysers Objects to be analysed –Formal documents that must follow a certain formal structure

5 Static analyzers: General form Static Analyser Document Eg. Source code Syntax violation Deviation Data flow info Control flow info

6 Static analysis Who and when used static analysis tools? –Developers –Before and during component or integration testing To check if guidelines or programming conventions are adhered to –During integration testing : analyse adherence to interface guidelines What are produced by static analysis tools? –List of warnings and comments Syntax violation Deviation from conventions and standards Control flow anomalies Data flow anomalies metrics

7 Static Analysis If a static analysis is performed before a review, a number of defects can be found and the number of the aspects to be checked in the review clearly decreases –Thus much less effort in a review Not all defects can be found using static testing –Some defects become apparent only when the program is executed (runtime) Example: division by zero valued variable

8 Compiler as Static Analysis Tool Detection of violation of the programming language syntax; reported as a fault or warning Further information and other checks –Generating a cross reference list of the different program elements (eg variables, functions) –Checking for correct data type usage by data and variables in programming languages with strict typing –Detecting undeclared variables –Detecting code that is not reachable –Detecting overflow or underflow of field boundaries –Checking of interface consistency –Detecting the use of all labels as jump start or jump target

9 Data Flow Analysis What is it? –A form of static analysis based on the definition and usage of variables How it is performed? –Analysis of data use The usage of data on paths through the program code is checked Use to detect data flow anomalies –Unintended or unexpected sequence of operations on a variable What is an anomaly? –An inconsistency that can lead to failure, but does not necessarily so –May be flagged as a risk

10 Data Flow Analysis Examples of data flow anomalies –Reading variables without previous initialization –Not using the values of a variable at all The usage of every single variable is inspected Three types of usage or states of variables –Defined (d) : the variable is assigned a value –Reference (r) : the value of the variable is read and/or used –Undefined (u) : the variable has no defined value

11 Data Flow Analysis Three types of data flow anomalies –ur-anomaly : an undefined value (u) of a variable is read on a program path (r) –du-anomaly : the variable is assigned a value (d) that becomes invalid/undefined (u) without having been used in the meantime –dd-anomaly : the variable receives a value for the second time (d) and the first value had not been used (d)

12 Data Flow Analysis: Example The following function is supposed to exchange the integer Value of the parameters Max and Min with the help of the variable Help, if the value of the variable Min is greater than the value of the variable Max void exchange (int& Min, int& Max) { int Help; if (Min > Max) { Max = Help; Max = Min; Help = Min; }

13 Data Flow Analysis: Example The following anomalies detected: –ur-anomaly of the variable Help The domain of the variable is limited to the function The first usage of the variable is on the right side of an assignment At this time, the variable still has an undefined value, which is referenced there There was no initialization of the variable when it was declared –dd-anomaly of variable Max The variable is used twice consecutively on the left side of an assignment and therefore is assigned a value twice Either the first assignment can be omitted or the use of the first value has been forgotten

14 Data Flow Analysis: Example The following anomalies detected: –du-anomaly of the variable Help In the last assignment of the function the variable Help is assigned another value that cannot be used anywhere This is because the variable is only valid inside the function

15 void exchange (int& Min, int& Max) { int Help; if (Min > Max) { Max = Help; Max = Min; Help = Min; } Help = Max; Max = Min; Min = Help;

16 Control Flow Analysis What is control flow? –An abstract representation of all possible sequences of events (paths) in the execution of a component or system A program structure is represented (modeled) by a control flow graph (CFG) CFG is a directed graph that shows a sequence of events (paths) in the execution through a component or system CFG consists of nodes and edges –Node represents a statement or a sequence of statements –Edge represents control flows from one statement to another

17 Control Flow Analysis Basic constructs of CFG –Sequence of assignment statements –IF … THEN … ELSE statement –WHILE DO statement DO WHILE IF … THEN

18 Control Flow : example A DO IF C THEN IF D THEN IF E THEN F ELSE G ELSE IF H THEN J ELSE K ELSE L WHILE B M A C D E F G H J K L B M Modeled as

19 Control Flow Anomalies Statically detected anomaly in the control flow of a test object Example –Jumps out of a loop body –Program structure has many exits

20 Determining Metrics Quality characteristics can be measured with metrics The intention is to gain a quantitative measure of software whose nature is abstract Example: –McCabe’s metric or cyclomatic complexity, V –Measures the structural complexity of program code –Based on CFG –V(G) = e - n + 2 where V(G) is cyclomatic number of graph G e = number of edges in G n = number of nodes in G

21 Determining Metrics Example: for CFG in previous slide V(G) = e - n + 2 = 16 – = 6 V(G) higher than 10 can not be tolerated and rework of the source code has to take place V(G) can be used to estimate the testability and maintainability V(G) specifies the number of linearly independent paths in the program

22 Summary Static testing can be done to find defect and deviation using: –Structured group examinations Reviews –Inspection, walkthrough, technical review, informal review –Static analysis using static analyzers Compiler Data flow analysis Control flow analysis