CS 217 Software Verification and Validation Week 9, Summer 2014 Instructor: Dong Si

Slides:



Advertisements
Similar presentations
SOFTWARE TESTING. Software Testing Principles Types of software tests Test planning Test Development Test Execution and Reporting Test tools and Methods.
Advertisements

Introducing Formal Methods, Module 1, Version 1.1, Oct., Formal Specification and Analytical Verification L 5.
Testing and Quality Assurance
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
Software Failure: Reasons Incorrect, missing, impossible requirements * Requirement validation. Incorrect specification * Specification verification. Faulty.
CMSC 345, Version 11/07 SD Vick from S. Mitchell Software Testing.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
Testing an individual module
Software Testing. “Software and Cathedrals are much the same: First we build them, then we pray!!!” -Sam Redwine, Jr.
School of Computer ScienceG53FSP Formal Specification1 Dr. Rong Qu Introduction to Formal Specification
Chapter 11: Testing The dynamic verification of the behavior of a program on a finite set of test cases, suitable selected from the usually infinite execution.
1 Software Testing Techniques CIS 375 Bruce R. Maxim UM-Dearborn.
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
Software Testing Verification and validation planning Software inspections Software Inspection vs. Testing Automated static analysis Cleanroom software.
CS527: (Advanced) Topics in Software Engineering Overview of Software Quality Assurance Tao Xie ©D. Marinov, T. Xie.
©Ian Sommerville 2000Software Engineering, 6th edition. Chapter 19Slide 1 Verification and Validation l Assuring that a software system meets a user's.
System/Software Testing
CS 217 Software Verification and Validation Week 2, Summer 2014 Instructor: Dong Si
Testing. Definition From the dictionary- the means by which the presence, quality, or genuineness of anything is determined; a means of trial. For software.
University of Palestine software engineering department Testing of Software Systems Fundamentals of testing instructor: Tasneem Darwish.
Chapter 1: Introduction to Software Testing Software Testing
DKT311 Software Engineering Dr. Rozmie Razif bin Othman.
University of Palestine software engineering department Testing of Software Systems Fundamentals of testing instructor: Tasneem Darwish.
CS 217 Software Verification and Validation Week 6, Summer 2014 Instructor: Dong Si
CMSC 345 Fall 2000 Unit Testing. The testing process.
Chapter 12: Software Testing Omar Meqdadi SE 273 Lecture 12 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
1 Debugging and Testing Overview Defensive Programming The goal is to prevent failures Debugging The goal is to find cause of failures and fix it Testing.
CSC 480 Software Engineering Lecture 14 Oct 16, 2002.
Verification and Validation Overview References: Shach, Object Oriented and Classical Software Engineering Pressman, Software Engineering: a Practitioner’s.
Introduction to Software Testing
1 Software testing. 2 Testing Objectives Testing is a process of executing a program with the intent of finding an error. A good test case is in that.
CS 217 Software Verification and Validation Week 3, Summer 2014 Instructor: Dong Si
© 2008 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice Testing 29/Apr/2009 Petr Panuška.
Software Testing Testing types Testing strategy Testing principles.
Software Testing The process of operating a system or component under specified conditions, observing and recording the results, and making an evaluation.
Test Coverage CS-300 Fall 2005 Supreeth Venkataraman.
637 – Introduction (Ch 1) Introduction to Software Testing Chapter 1 Jeff Offutt Information & Software Engineering SWE 437 Software Testing
Black-box Testing.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 22 Slide 1 Software Verification, Validation and Testing.
CS 217 Software Verification and Validation Week 7, Summer 2014 Instructor: Dong Si
1 Introduction to Software Testing. Reading Assignment P. Ammann and J. Offutt “Introduction to Software Testing” ◦ Chapter 1 2.
1 Ch. 1: Software Development (Read) 5 Phases of Software Life Cycle: Problem Analysis and Specification Design Implementation (Coding) Testing, Execution.
Introduction to Software Testing Paul Ammann & Jeff Offutt Updated 24-August 2010.
Chapter 1: Fundamental of Testing Systems Testing & Evaluation (MNN1063)
Software Engineering1  Verification: The software should conform to its specification  Validation: The software should do what the user really requires.
CS451 Lecture 10: Software Testing Yugi Lee STB #555 (816)
SOFTWARE TESTING. Introduction Software Testing is the process of executing a program or system with the intent of finding errors. It involves any activity.
Software Quality Assurance and Testing Fazal Rehman Shamil.
 Software Testing Software Testing  Characteristics of Testable Software Characteristics of Testable Software  A Testing Life Cycle A Testing Life.
Dynamic Testing.
Workshop on Integrating Software Testing into Programming Courses (WISTPC14:2) Friday July 18, 2014 Introduction to Software Testing.
Chapter 12: Software Testing Omar Meqdadi SE 273 Lecture 12 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Testing Overview Software Reliability Techniques Testing Concepts CEN 4010 Class 24 – 11/17.
SOFTWARE TESTING SOFTWARE TESTING Presented By, C.Jackulin Sugirtha-10mx15 R.Jeyaramar-10mx17K.Kanagalakshmi-10mx20J.A.Linda-10mx25P.B.Vahedha-10mx53.
Introduction to Software Testing Maili Markvardt.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
Software Testing. SE, Testing, Hans van Vliet, © Nasty question  Suppose you are being asked to lead the team to test the software that controls.
Defect testing Testing programs to establish the presence of system defects.
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.
Dr. Rozmie Razif bin Othman
Software Testing.
Software Testing.
Verification and Validation Overview
Types of Testing Visit to more Learning Resources.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
CS201: Data Structures and Discrete Mathematics I
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
CS201: Data Structures and Discrete Mathematics I
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Presentation transcript:

CS 217 Software Verification and Validation Week 9, Summer 2014 Instructor: Dong Si

REVIEW OF THE CLASS

What is (software) testing?

Softeware Testing – definition n The process consisting of all life cycle activities, concerned with planning, preparation and evaluation of software products and related work products to determine: –that they satisfy specified requirements, –to demonstrate that they are fit for purpose and –to detect defects 4

Validation & Verification n Validation : Have we built the right software? n i.e., do the requirements satisfy the customer? n (This is dynamic process for checking and testing the real product. Software validation always involves with executing the code) n Verification : Have we built the software right? n i.e., does it implement the requirements? n This is static method for verifying design, code. Software verification is human based checking of documents and files Introduction to Software Testing, Edition 2 (Ch 1) © Ammann & Offutt 5

Introduction to Software Testing, Edition 2 (Ch 1) © Ammann & Offutt 6 n Software Fault : A static defect in the software n Software Failure : External, incorrect behavior with respect to the requirements or other description of the expected behavior n Software Error : An incorrect internal state that is the manifestation/expression of some fault Faults in software are equivalent to design mistakes in hardware. Software does not degrade. Software Faults, Errors & Failures

Fault and Failure Example n The doctor tries to diagnose the root cause, the disease –Fault n A patient gives a doctor a list of symptoms –Failures n The doctor may look for anomalous internal conditions (high blood pressure, irregular heartbeat, bacteria in the blood stream) –Errors Introduction to Software Testing, Edition 2 (Ch 1) © Ammann & Offutt 7 Most medical problems result from external attacks (bacteria, viruses) or physical degradation as we age. They were there at the beginning and do not “appear” when a part wears out.

Sources of Problems n Requirements Definition: Erroneous, incomplete, inconsistent requirements. n Design: Fundamental design flaws in the software. n Implementation: Mistakes in chip fabrication, wiring, programming faults, malicious code. n Support Systems: Poor programming languages, faulty compilers and debuggers, misleading development tools.

Sources of Problems (Cont’d) n Inadequate Testing of Software: Incomplete testing, poor verification, mistakes in debugging. n Evolution: Sloppy redevelopment or maintenance, introduction of new flaws in attempts to fix old flaws, incremental escalation to inordinate complexity.

Summary: Why Do We Test Software ? Introduction to Software Testing, Edition 2 (Ch 1) © Ammann & Offutt 10 A tester’s goal is to eliminate faults as early as possible Improve quality Improve quality Reduce cost Reduce cost Preserve customer satisfaction Preserve customer satisfaction

Testing main principles

Testing Principles (1) n Testing can demonstrate only the presence of defects and not their absence –Testing can show that defects are present, but cannot prove that there are no defects. Testing reduces the probability of undiscovered defects remaining in the software but, even if no defects are found, it is not a proof of correctness. n Exhaustive testing is impossible –Exhaustive testing (all combinations of inputs and preconditions) is not feasible except for trivial cases. Instead of exhaustive testing, risk analysis and priorities should be used to focus testing efforts.

Testing Principles (2) n Early testing is important –Testing activities should start as early as possible in the software or system development life cycle and should be focused on defined objectives. n Defects are clustering –A small number of modules contain most of the defects discovered during pre-release testing, or are responsible for the most operational failures.

Testing Principles (3) n Testing is context dependent –Testing is done differently in different contexts. For example, military software is tested differently from an business site.

Software Testing Process 15 Unit test Integration test System test System engineering Software Design Code & Implementation V&V Targets

Software Development Lifecycles n Code and Fix n Waterfall n Cycle

BASIC OF LOGICS

Motivation n LOGIC enabled mathematicians to point out WHY a proof is wrong, or WHERE in the proof, the reasoning has been faulty. n Faults (bugs) have been detected in proofs (programs) n Is such a tool that by symbolizing arguments rather than writing them out in some natural language (which is fraught with ambiguity), checking the correctness of a proof becomes a much more viable task. 18

Introduction to Logic  CS areas where we use LOGIC  Architecture (logic gates)  Software Engineering (Validation & Verification)  Programming Languages (Semantics & Logic Programming)  AI (Automatic theorem proving)  Algorithms (Complexity)  Databases (SQL) 19

Fundamental of Logic  Declarative statements n Examples of declarative statements –“A is older than B” –“There is ice in the glass” –In CIS, describing the data (variables, functions, etc.) 20

 Propositions - a statement that is either true or false.  For every proposition p, either p is T or p is F  For every proposition p, it is not the case that p is both T and F 21

Fundamental of Logic n We not only want to specify such statements, but also want to check whether a given program or system fulfills specifications that user needs. (Validation) n We are interested in precise declarative statements about computer systems and programs. (Verification) 22

Propositional Logic: Basics n Propositional logic describes ways to combine some true statements to produce other true statements. n If it is proposed that `Jack is taller than John' and `John can run faster than Jack' are both T =`Jack is taller than John and John can run faster than Jack'. n Propositional logic allows us to formalize such statements. n In concise form: A ^ B 23

Propositional Logic n Composition of atomic sentences p: I won the lottery yesterday q: I will purchase a lottery ticket today r: I played a football game yesterday n ~ p: Negation. “I did not win the lottery last week” n p v r: Disjunction. The statement is true if at least one of them is true. “I won the lottery or played a football game yesterday.” 24

Propositional Logic n p ^ r: Conjunction. “Yesterday I won the lottery and played a football game.” n p q: Implication. “If I won the lottery last week, then I will purchase a lottery ticket today.” p is called the assumption and q is called conclusion. –p implies q –If p then q 25

Natural Deduction n Proof n Set of rules which allow us to draw a conclusion by given a set of preconditions n Constructing a proof is much like a programming! n It is not obvious which rules to apply and in what order to obtain the desired conclusion, be careful to choose proof rules! 26

Rules of Natural Deduction n Fundamental rule 1 (rule of detachment) p p q... q n The rule is a valid inference because [p ^ (p q)] q is a tautology! 27

Rules of Natural Deduction n Example: if it is 11:00 o’ clock in Norfolk if it is 11:00 o’ clock in Norfolk, then it is 11:00 o’ clock in DC then by rule of detachment, we must conclude: it is 11:00 o’ clock in DC 28

Rules of Natural Deduction n Fundamental rule 2 (transitive rule) p q q r... p r This is a valid rule of inference because the implication (p q) ^ (q r) (p r) is a tautology! 29

Rules of Natural Deduction n FR 3 (De Morgan’s law) ~(p v q) = (~p) ^ (~q) ~(p ^ q) = (~p) v (~q) n FR 4 (Law of contrapositive) p q = (~q ~p) n FR 5 (Double Negation) ~(~p) = p 30

Examples of Arguments n If a baby is hungry, then the baby cries. If the baby is not mad, then he does not cry. If a baby is mad, then he has a red face. Therefore, if a baby is hungry, then he has a red face. n Model this problem!! n h: a baby is hungry c: a baby cries m: a baby is mad r: a baby has a red face 31 h c ~m ~c m r... h r h c c m m r... h r

Logic is the Skeleton n What remains when arguments are symbolized is the bare logical skeleton n It is this form that enables us to analyze the program / code / software. n Software V&V = Logical proof & Logic error detection 32

n Q4. Problem: “Tom is a math major but not computer science major” M: Tom is a math major C: Tom is a computer science major n Tasks: Use De Morgan's Law to write the negation of the above statement as logic expression

n Answer: n Original: n M Λ ¬ C (Tom is a math major but not computer science major) n Negation: n ¬ (M Λ ¬ C) = ¬ M V ¬ (¬ C) (De Morgan's Laws) = ¬ M V C (Double negation rule) 34

BLACK-BOX TESTING & WHITE-BOX TESTING

Differences Between BB and WB 36

Black-Box Testing 37

White-Box testing 38

REVIEW OF BB-testing

Black-box Testing 1. Input Space Partitioning 2. Boundary Value Analysis 40

Example 1: compare two numbers – p50 of week3 n Function ‘Compare (x, y)’ n Inputs: Two numbers – x and y n Outputs: A larger number between x and y 41 Compare (x, y) = z (x, y) z

– p51 of week3 42 Equivalence Classes: { (x, y) | x < y } { (x, y) | x > y } { (x, y) | x = y } { input other than a pair of numbers, “as&%dfget^$(&w” } Valid inputs Invalid inputs

43 Valid (x, y) Input Space x = y x < y x > y Three test cases: (1, 2) (8, 8) (100, 30) Plus one test cases: (^&%*) --- ERROR – p52 of week3

Example 2: Loan application - p53 of week3 44 Customer Name Account number Loan amount requested Term of loan Monthly repayment Term: Repayment: Interest rate: Total paid back: 6 digits, 1st non-zero $500 to $ to 30 years Minimum $ chars. Choosing (or defining) partitions seems easy, but is easy to get wrong…

45 Customer name Number of characters: invalidvalidinvalid 1 Valid characters: Any other A-Z a-z -’ space

46 Loan amount invalidvalidinvalid 499

WB Testing Techniques n Logic coverage: (learned in previous classes)  Statement coverage  Branch coverage  Condition coverage  … n Dataflow based testing / Path coverage: all program paths have been traversed at least once 47

Pseudo code & Control/Dataflow Graphs 48 “nodes” “edges” Input output Absolute (x) { IF (x>=0) THEN y = x; ELSE IF (x<0) THEN y = -x; Output y; } x IF (x>=0)ELSE IF (x<0) y = x; y = -x; y