Foundations of Software Testing Chapter 1: Preliminaries Last update: September 3, 2007 These slides are copyrighted. They are for use with the Foundations.

Slides:



Advertisements
Similar presentations
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
Advertisements

10 Software Engineering Foundations of Computer Science ã Cengage Learning.
Foundations of Software Testing Chapter 1: Section 1.19 Coverage Principle and the Saturation Effect Aditya P. Mathur Purdue University Last update: August.
1 Static Testing: defect prevention SIM objectives Able to list various type of structured group examinations (manual checking) Able to statically.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
Software Requirements
Foundations of Software Testing Chapter 1: Preliminaries Last update: September 3, 2007 These slides are copyrighted. They are for use with the Foundations.
Testing an individual module
Copyright © Cengage Learning. All rights reserved.
Foundations of Software Testing Slides based on: Draft V1.0 August 17, 2005 Preliminaries Last update: September 15, 2005 These slides are copyrighted.
Software Integration and Documenting
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.
Dr. Pedro Mejia Alvarez Software Testing Slide 1 Software Testing: Building Test Cases.
System/Software Testing
BASICS OF SOFTWARE TESTING
Software Testing Content Essence Terminology Classification –Unit, System … –BlackBox, WhiteBox Debugging IEEE Standards.
CMSC 345 Fall 2000 Unit Testing. The testing process.
Chapter 8 – Software Testing Lecture 1 1Chapter 8 Software testing The bearing of a child takes nine months, no matter how many women are assigned. Many.
Verification and Validation Overview References: Shach, Object Oriented and Classical Software Engineering Pressman, Software Engineering: a Practitioner’s.
Overview of Software Testing 07/12/2013 WISTPC 2013 Peter Clarke.
Foundations of Software Testing Chapter 5: Test Selection, Minimization, and Prioritization for Regression Testing Last update: September 3, 2007 These.
Chapter 14 System Testing.
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
Grey Box testing Tor Stålhane. What is Grey Box testing Grey Box testing is testing done with limited knowledge of the internal of the system. Grey Box.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 22 Slide 1 Software Verification, Validation and Testing.
1 Introduction to Software Engineering Lecture 1.
Today’s Agenda  HW #1  Finish Introduction  Input Space Partitioning Software Testing and Maintenance 1.
Introduction to Problem Solving. Steps in Programming A Very Simplified Picture –Problem Definition & Analysis – High Level Strategy for a solution –Arriving.
Course for Software Testing BS (Software Engineering) Spring Semester February 2014 Foundation University Rawalpindi Campus Instructor: Sohaib Altaf
Today’s Agenda  Reminder: HW #1 Due next class  Quick Review  Input Space Partitioning Software Testing and Maintenance 1.
Requirements Specification. Welcome to Software Engineering: “Requirements Specification” “Requirements Specification”  Verb?  Noun?  “Specification”
Formal Methods.
Foundations of Software Testing Chapter 1: Preliminaries Last update: September 3, 2007 These slides are copyrighted. They are for use with the Foundations.
Scientific Debugging. Errors in Software Errors are unexpected behaviors or outputs in programs As long as software is developed by humans, it will contain.
Software Engineering1  Verification: The software should conform to its specification  Validation: The software should do what the user really requires.
Capturing Requirements. Questions to Ask about Requirements 1)Are the requirements correct? 2)Consistent? 3)Unambiguous? 4)Complete? 5)Feasible? 6)Relevant?
1 Phase Testing. Janice Regan, For each group of units Overview of Implementation phase Create Class Skeletons Define Implementation Plan (+ determine.
1 © 2011 Professor W. Eric Wong, The University of Texas at Dallas Requirements-based Test Generation for Functional Testing W. Eric Wong Department of.
Testing Overview Software Reliability Techniques Testing Concepts CEN 4010 Class 24 – 11/17.
Foundations of Software Testing Chapter 7: Test Adequacy Measurement and Enhancement Using Mutation Last update: September 3, 2007 These slides are copyrighted.
Foundations of Software Testing Chapter 5: Test Selection, Minimization, and Prioritization for Regression Testing Last update: September 3, 2007 These.
Foundations of Software Testing Chapter 7: Test Adequacy Measurement and Enhancement Using Mutation Last update: September 3, 2007 These slides are copyrighted.
Verification vs. Validation Verification: "Are we building the product right?" The software should conform to its specification.The software should conform.
Software Testing. SE, Testing, Hans van Vliet, © Nasty question  Suppose you are being asked to lead the team to test the software that controls.
SOFTWARE TESTING AND QUALITY ASSURANCE. Software Testing.
1 Software Testing. 2 What is Software Testing ? Testing is a verification and validation activity that is performed by executing program code.
CS223: Software Engineering Lecture 25: Software Testing.
Testing Integral part of the software development process.
Foundations of Software Testing Slides based on: Draft V1.0 August 17, 2005 Test Adequacy Measurement and Enhancement Using Mutation Last update: October.
©Ian Sommerville 2000Software Engineering, 6th edition. Chapter 19Slide 1 Verification and Validation l Assuring that a software system meets a user's.
Laurea Triennale in Informatica – Corso di Ingegneria del Software I – A.A. 2006/2007 Andrea Polini XVII. Verification and Validation.
Aditya P. Mathur Purdue University
A Review of Software Testing - P. David Coward
Software Testing.
Software Testing Day 1: Preliminaries
SOFTWARE TESTING OVERVIEW
Input Space Partition Testing CS 4501 / 6501 Software Testing
Verification and Testing
Verification and Validation Overview
Aditya P. Mathur Purdue University
BASICS OF SOFTWARE TESTING Chapter 1. Topics to be covered 1. Humans and errors, 2. Testing and Debugging, 3. Software Quality- Correctness Reliability.
Types of Testing Visit to more Learning Resources.
Software testing strategies 2
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Copyright © Cengage Learning. All rights reserved.
Laboratory of Advanced Research on Software Technology
Regression Testing.
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:

Foundations of Software Testing Chapter 1: Preliminaries Last update: September 3, 2007 These slides are copyrighted. They are for use with the Foundations of Software Testing book by Aditya Mathur. Please use the slides but do not remove the copyright notice. Aditya P. Mathur Purdue University

© Aditya P. Mathur Learning Objectives Terminology: Errors, testing, debugging, test process, CFG, correctness, reliability, oracles. Finite state machines Testing techniques

© Aditya P. Mathur Errors, faults, failures Programmers make errors ….introducing faults in the programs they write ….leading to a failure when program is run.

© Aditya P. Mathur Error, faults, failures Tester may make a mistake In observing the behavior

© Aditya P. Mathur Software quality Static quality attributes: structured, maintainable, testable code as well as the availability of correct and complete documentation. Dynamic quality attributes: software reliability, correctness, completeness, consistency, usability, and performance.

© Aditya P. Mathur Software quality (contd.) Completeness refers to the availability of all features listed in the requirements. Consistency refers to adherence to a common conventions. An example of inconsistency -- a database displaying the date of birth of a person in different formats. Usability refers to the ease with which an application can be used. Performance refers to the time the application takes to perform a requested task. It is a non-functional requirement.

© Aditya P. Mathur Requirements, behavior, correctness Requirement 1: Write a program that inputs two integers and outputs the maximum of these. Requirement 2: Write a program that inputs a sequence of integers and outputs the sorted version of this sequence. Requirements leading to two different programs:

© Aditya P. Mathur Requirements: Incompleteness Suppose that program max is developed to satisfy Requirement 1. Suppose now that the tester wants to know if the two integers are to be input to the program on one line or on two separate lines. The requirement as stated above fails to provide an answer to this question.

© Aditya P. Mathur Requirements: Ambiguity Requirement 2 is ambiguous. It is not clear whether the input sequence is to sorted in ascending or in descending order. The behavior of sort program will depend on the decision taken by the programmer.

© Aditya P. Mathur Input domain (Input space) The set of all possible inputs to a program P is known as the input domain of P. Using Requirement 1 above we find the input domain of max to be the set of all pairs of integers where each element in the pair integers is in the range -32,768 till 32,767.

© Aditya P. Mathur Input domain (Continued) Modified Requirement 2: Write a program that inputs a sequence of integers and outputs the integers in this sequence sorted in either ascending or descending order. The order of the output sequence is determined by an input request character that should be ``A'’ for ascending and ``D'' otherwise. The request character is input first followed by the sequence of integers to be sorted; the sequence is terminated with a period.

© Aditya P. Mathur Input domain (Continued) Based on the above modified requirement, the input domain for sort is a set of pairs. The first element of the pair is a character. The second element of the pair is a sequence of zero or more integers ending with a period.

© Aditya P. Mathur Valid/Invalid Inputs The modified requirement for sort mentions that the request characters can be ``A'' and ``D'', but fails to answer the question -- ``What if the user types a different (invalid) character ?’’ The requirement for sort does not specify what action it should take when an invalid input is encountered.

© Aditya P. Mathur Correctness vs. Reliability Though correctness of a program is desirable, it is not the objective of testing. To establish correctness via testing would imply testing a program on all elements in the input domain. Often, in practice, this is impossible to accomplish. Thus correctness is established via mathematical proofs of programs.

© Aditya P. Mathur Correctness and Testing While correctness attempts to establish that the program is error free, testing attempts to find if there are any errors in it. Thus testing does not demonstrate that a program is error free. Testing, debugging, and the error removal processes together increase our confidence in the correct functioning of the program under test.

© Aditya P. Mathur Software reliability: two definitions Software reliability [ANSI/IEEE Std ]: is the probability of failure free operation of software over a given time interval and under given conditions. Software reliability is the probability of failure free operation of software in its intended environment.

© Aditya P. Mathur Operational profile An operational profile is a numerical description of how a program is used. Consider a sort program which, on any given execution, allows any one of two types of input sequences.

© Aditya P. Mathur Testing and debugging Testing is the process of determining if a program has any errors. When testing reveals an error, the process used to determine the cause of this error and to remove it, is known as debugging.

© Aditya P. Mathur A test/debug cycle No Yes

© Aditya P. Mathur Test plan A test cycle is often guided by a test plan. Example: If the sort program is to be tested to meet the requirements given earlier, the following needs to be done. Execute sort on at least two input sequences, one with ``A'' and the other with ``D'' as request characters.

© Aditya P. Mathur Test plan (contd.) Execute the program on an empty input sequence. Test the program for robustness against erroneous inputs such as ``R'' typed in as the request character. All failures of the test program should be recorded in a suitable form.

© Aditya P. Mathur Test case/data A test case is a pair consisting of test data to be input to the program and the expected output. A test set is a collection of zero or more test cases. Sample test case for sort: Test data: Expected output:

© Aditya P. Mathur Program behavior Can be specified in several ways: plain natural language, a state diagram, formal mathematical specification, etc. A state diagram specifies program states and how the program changes its state on an input sequence: e.g., GUI.

© Aditya P. Mathur Behavior: observation and analysis The entity that checks the correctness of the observed behavior is known as an oracle. First step – observe behavior. Second step – analyze behavior to check if it is correct. The above steps can be quite complex for large programs.

© Aditya P. Mathur Oracle: Programs Oracles can also be programs designed to check the behavior of other programs. For example, one might use a matrix multiplication program to check if a matrix inversion program has produced the correct output.

© Aditya P. Mathur Oracle: Construction Construction of automated oracles, such as the one to check a matrix multiplication program or a sort program, requires the determination of input-output relationship. In general, the construction of automated oracles is itself a Complex task.

© Aditya P. Mathur Testing vs. verification Program verification aims to prove the correctness of programs by showing that it contains no errors. This is different from testing that aims to uncover errors in a program. In practice, one can skip verification, but not testing.

© Aditya P. Mathur Testing and verification (contd.) Testing is not a perfect technique in that a program might contain errors despite the success of a set of tests. Verification might appear to be perfect technique as it promises to verify that a program is free from errors. However, the person who verified a program might have made mistake in the verification process; there might be an incorrect assumption on the input conditions; etc.

© Aditya P. Mathur Test generation Test generation is based upon a requirements document. Informal test method – the requirements resides in the mind of the tester who generates tests based on this knowledge. Formal test method – the tests are generated using a mix of formal and informal methods directly from the requirements document serving as the source.

© Aditya P. Mathur Test generation strategies Model based: require that a subset of the requirements be modeled using a formal notation. Examples: Finite State Machines, Petri nets, etc. Specification based: require that a subset of the requirements be modeled using a formal mathematical notation. Code based: generate tests directly from the code.

© Aditya P. Mathur Specifying embedded systems An embedded computer often receives inputs from its environment and responds with appropriate actions. While doing so, it moves from one state to another. Behavior of an embedded system in response to inputs is often modeled by a finite state machine (FSM).

© Aditya P. Mathur FSM: Actions with state transitions (a) Notice ADD, INIT, ADD,OUT actions. (b) INIT: Initialize num. ADD: Add to num. OUT: Output num. Machine to convert a sequence of decimal digits to an integer:

© Aditya P. Mathur Code based -- Program representation A basic block in program P is a sequence of consecutive statements with a single entry and a single exit point. Thus a block has unique entry and exit points. A control flow graph G=(N,E) is defined as a finite set N of nodes and a finite set E of edges. An edge (i, j) in E denotes flow of control from node n i to n j. We also assume that there is a Start node that has no incoming edge and an End node that has no outgoing edge.

© Aditya P. Mathur Basic blocks: Example Example: Computing x raised to y

© Aditya P. Mathur Basic blocks: Example (contd.) Basic blocks

© Aditya P. Mathur CFG Example N={Start, 1, 2, 3, 4, 5, 6, 7, 8, 9, End} E={(Start,1), (1, 2), (1, 3), (2,4), (3, 4), (4, 5), (5, 6), (6, 5), (5, 7), (7, 8), (7, 9), (9, End)}

© Aditya P. Mathur CFG Example N={Start, 1, 2, 3, 4, 5, 6, 7, 8, 9, End} E={(Start,1), (1, 2), (1, 3), (2,4), (3, 4), (4, 5), (5, 6), (6, 5), (5, 7), (7, 8), (7, 9), (9,End)} Same CFG with statements removed.

© Aditya P. Mathur Paths A sequence of k edges, k>0, (e_1, e_2, … e_k), in G=(N,E) denotes a path of length k through the flow graph if the following sequence condition holds. Given that n p, n q, n r, and n s are nodes belonging to N, and 0< i < k, if e i = (n p, n q ) and e i+1 = (n r, n s ) then n q = n r.

© Aditya P. Mathur Paths: sample paths p 1 = ( Start, 1, 2, 4, 5, 6, 5, 7, 9, End) p 2 = (Start, 1, 3, 4, 5, 6, 5, 7, 9, End) Two feasible and complete paths: Complete path (e.g., bold edges) Subpath (e.g., dashed edges) p 1 = ( (Start, 1), (1,2), (2,4), (4,5), (5,6), (6,5), (5,7), (7,9), (9,End)) Specified using edges:

© Aditya P. Mathur Paths: feasible paths p 1 = (Start, 1, 3, 4, 5, 6, 5, 7, 8, 9, End) ✔ p 2 = (Start, 1, 2, 4, 5, 7, 9, End) ✗ A path p through a flow graph for program P is considered feasible if there exists at least one test case which when input to P causes p to be traversed.

© Aditya P. Mathur Types of testing C1: Source of test generation. C2: Lifecycle phase in which testing takes place C3: Goal of a specific testing activity One possible classification is based on the following four classifiers:

© Aditya P. Mathur C1: Source of test generation

© Aditya P. Mathur C2: Lifecycle phase in which testing takes place

© Aditya P. Mathur C3: Goal of specific testing activity