Departamento de Informática Universidad de Valladolid Campus de Segovia TOPIC 7: SOFTWARE TESTING

Similar documents
Software Testing Fundamentals. Software Testing Techniques. Information Flow in Testing. Testing Objectives

Darshan Institute of Engineering & Technology for Diploma Studies

UNIT-4 Black Box & White Box Testing

Introduction to Software Engineering

UNIT-4 Black Box & White Box Testing

Program Correctness and Efficiency. Chapter 2

Topic: Software Verification, Validation and Testing Software Engineering. Faculty of Computing Universiti Teknologi Malaysia

Equivalence Class Partitioning. Equivalence Partitioning. Definition and Example. Example set of classes

Lecture 26: Testing. Software Engineering ITCS 3155 Fall Dr. Jamie Payton

Aerospace Software Engineering

CS 451 Software Engineering Winter 2009

What is Structural Testing?

Darshan Institute of Engineering & Technology Unit : 9

Computer Science and Software Engineering University of Wisconsin - Platteville 9-Software Testing, Verification and Validation

SE Notes Mr. D. K. Bhawnani, Lect (CSE) BIT

7.0 Test Design Techniques & Dynamic Testing

Software Testing part II (white box) Lecturer: Giuseppe Santucci

1 Visible deviation from the specification or expected behavior for end-user is called: a) an error b) a fault c) a failure d) a defect e) a mistake

Equivalence Class Partitioning and Boundary Value Analysis -Black Box Testing Techniques

Program Testing and Analysis: Manual Testing Prof. Dr. Michael Pradel Software Lab, TU Darmstadt

Testing Theory. Agenda - What will you learn today? A Software Life-cycle Model Which part will we talk about today? Theory Lecture Plan

Software Engineering (CSC 4350/6350) Rao Casturi

Software Engineering Fall 2015 (CSC 4350/6350) TR. 5:30 pm 7:15 pm. Rao Casturi 11/10/2015

Testing: Test design and testing process

Software Engineering Fall 2014

MTAT : Software Testing

Feasibility of Testing to Code. Feasibility of Testing to Code. Feasibility of Testing to Code. Feasibility of Testing to Code (contd)

Did you say transformations or transformers?

Examining the Code. [Reading assignment: Chapter 6, pp ]

An Introduction to Systematic Software Testing. Robert France CSU

Recap on SDLC Phases & Artefacts. Topic: Software Verification, Validation and Testing Software Engineering

Testing & Debugging TB-1

STRUCTURAL TESTING. AKA White Box Testing. Thanks go to Andreas Zeller for allowing incorporation of his materials. F. Tip and M.

People tell me that testing is

Software Testing. Testing 1

Software Testing for Developer Development Testing. Duvan Luong, Ph.D. Operational Excellence Networks

LECTURE 9 TEST DESIGN TECHNIQUES - II

STRUCTURAL TESTING. AKA White Box Testing. Thanks go to Andreas Zeller for allowing incorporation of his materials. F. Tip and M.

Black Box Testing (revisited) Csci 565 Spring 2007

Structural Testing. White Box Testing & Control Flow Analysis

Lecture 15 Software Testing

Part I: Preliminaries 24

linaye/gl.html

Software Engineering Software Testing Techniques

EXAMINING THE CODE. 1. Examining the Design and Code 2. Formal Review: 3. Coding Standards and Guidelines: 4. Generic Code Review Checklist:

CS 520 Theory and Practice of Software Engineering Fall 2018

PES INSTITUTE OF TECHNOLOGY- BANGALORE SOUTH CAMPUS

A Beginner s Guide to Programming Logic, Introductory. Chapter 6 Arrays

VETRI VINAYAHA COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

Leveraging Data Invariants in Model Inference for Test Case Generation

Software Testing. 1. Testing is the process of demonstrating that errors are not present.

Chapter 14 Testing Tactics

Lecture 10: Introduction to Correctness

Software Testing. Testing: Our Experiences

Testing is executing a system in order to identify any gaps, errors, or missing requirements in contrary to the actual requirements.

Introduction to Problem Solving and Programming in Python.

Chapter 11, Testing. Using UML, Patterns, and Java. Object-Oriented Software Engineering

MTAT : Software Testing

Subject Software Testing Structural Testing

Lecture 14: Chapter 18!

Keywords Test case prioritization, TCP, software testing, Basic path testing, Source code analysis

Departamento de Informática Universidad de Valladolid Campus de Segovia CHAPTER 2: POINTERS AND DYNAMIC MEMORY ALLOCATION

Subject: Software Engineering & UML (MCA 401)

SOFTWARE TESTING UNIT II TEST CASE DESIGN

Testing Tactics. Structural Testing. Why Structural? Why Structural? Functional black box. Structural white box. Functional black box

Software Testing. Software Testing

QUIZ #5 - Solutions (5pts each)

[IT6004-SOFTWARE TESTING] UNIT 2

Structural Testing. Testing Tactics. Why Structural? Structural white box. Functional black box. Structural white box. Functional black box

CS 4387/5387 SOFTWARE V&V LECTURE 4 BLACK-BOX TESTING

Programming Embedded Systems

Test Design Techniques ISTQB (International Software Testing Qualifications Board)

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING CS SOFTWARE ENGINEERING

Testing & Continuous Integration. Kenneth M. Anderson University of Colorado, Boulder CSCI 5828 Lecture 20 03/19/2010

UNIT 1-2 MARKS QUESTIONS WITH ANSWERS

Math 575 Exam 3. (t). What is the chromatic number of G?

Compiler Construction

Structural Testing. (c) 2007 Mauro Pezzè & Michal Young Ch 12, slide 1

IACUC Researcher s Quick Reference

Outline. software testing: search bugs black-box and white-box testing static and dynamic testing

PESIT Bangalore South Campus

Terminology. There are many different types of errors and different ways how we can deal with them.

Theme 2 Program Design and Testing

2.9 Modularization. Department of CSE,Coimbatore

Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur

Chapter 9. Software Testing

How to Use Adhoc Parameters in Actuate Reports

MTAT : Software Testing

Figure 28.1 Position of the Code generator

CSE 215: Foundations of Computer Science Recitation Exercises Set #4 Stony Brook University. Name: ID#: Section #: Score: / 4

Testing Methods: White Box Testing II

Functional Programming in Haskell Prof. Madhavan Mukund and S. P. Suresh Chennai Mathematical Institute

CHAPTER 7 COMPOSITION AND DECOMPOSITION

Lecture 20: SW Testing Presented by: Mohammad El-Ramly, PhD

UNIT 1-SOFTWARE PROCESS AND PROJECT MANAGEMENT

MTAT : Software Testing

Sample Exam Syllabus

CSE 403: Software Engineering, Fall courses.cs.washington.edu/courses/cse403/16au/ Unit Testing. Emina Torlak

Principles of Programming Languages

Testing: Coverage and Structural Coverage

Transcription:

Departamento de Informática Universidad de Valladolid Campus de Segovia TOPIC 7: SOFTWARE TESTING

SOFTWARE TESTING Introduction Psycological aspects of software testing Information flow of software testing Indirect test. Direct test. Design of test cases Integration testing Debbuging

SOFTWARE TESTING TECNIQUES. INTRODUCTION It represents a final revision of the specification, design and encoding phases. Main goal of software testing: Tofinderrors The purpose of software testing is to design test data sets with a high probability to find a new error.

PSYCOLOGICAL ASPECTS OF SOFTWARE TESTING Software testing is usually not well regarded by programmers Some external aspects such as temporal limitations, product s costs, product s chances, together the not well understood destructive nature of software testing does not make easy this task. In this sense, it might be justified to distrust of the programmer objectivity when he tests his appplication. That is the reason to involve an external referee team during the testing process.

FLOW OF INFORMATION SOFTWARE CONFIGURATION TESTING RESULTS TEST ASSESMENT ERRORS DEBUGGING TEST CONFIGURATION ERROR RATE DATA CORRECTIONS EXPECTED RESULTS MODELO DE FIABILIDAD SOFTWARE CONFIGURATION: Requirement specification Design specification Source code TEST CONFIGURATION: Process planning Test tools Test cases Expected results RELIABILITY PREDICTIOONS

INDIRECT TEST These methods are known as indirect since they are performed without a computer These ones are carried out just after the encoding phase and before testing the software using a computer. The indirect test involves a visual inspection of program code and they are performed by a team of analyst and programmers. Main goal: Find errors, no solutions. This testing approach detects groups of errors allowing after a massive correction.

DESIGNING TEST CASES There are two main product-testing approch: White-box tets: Also known as clear box testing, glass box testing or structural testing uses an internal perspective of the system to design test cases based on internal structure. Black-box test: takes an external perspective of the test object to derive test cases.the test designer selects valid and invalid input and determines the correct output. There is no knowledge of the test object's internal structure. A more complete software testing process is achieved combining both approachs.

DESIGN TECNIQUES TO DESIGN TEST CASES Purpose: Reduce the number of test case mantaining the test effectivity. According to the approachs: Black-box (what it does) White-box (how it is done):

WHITE-BOX TEST As it was mentioned before these tecniques uses an internal perspective of the system to design test cases. The test cases generated by means of whitebox approach have to ensure: That all the independent paths of an specific module will be executed at least once. That all the logical decisions will be performed taking into account both the te true and false values. That all loops will be exexuted regarding their operational limits. That all the internal data structure will be tested.

CICLOMATIC COMPLEXITY METRIC This metric allow us to measure the logical complexity of a procedural design. This measurement may be used to define a basic set of execution paths In order to determine the ciclomatic complexity a control flow graph will be used.

CONTROL FLOW GRAPH It is a representation, using graph notation, of all paths that might be traversed through a program during its execution. Each node in the graph represents a basic block, i.e. a straight-line piece of code without any jumps Directed edges are used to represent jumps in the control flow. There are, in most presentations, two specially designated blocks: the entry block, through which control enters into the flow graph, and the exit block, through which all control flow leaves.

GRAPHICAL REPRESENTATION OF SOME COMMON CONTROL STRUCTURES SEQUENCE THEN IF END-IF IF SELECTION ELSE WHILE-LOOP

REPRESENTACIÓN DEL GRAFO DE FLUJO DE LAS ESTRUCTURAS DE CONTROL REPEAT-LOOP OPTION 1 CASE SELECTION CASE OPTION 2 END CASE... OPTION n

AN EXAMPLE DESCRIPTION USING A FLOWCHART 1 BEGINNING END 2 3 6 7 8 9 10 4 5

THE SAME EXAMPLE DESCRIPTION USING A CONTROL FLOW GRAPH. 1 11 2,3 6 4,5 7 8 9 10

FLOW GRAPHS RELATED TO LOGICAL COMPOSED CONDITIONS F B F T A T X IF A OR B THEN X ELSE Y Y X END IF T A F T B F Y IF A AND B THEN X ELSE Y X END IF Y

CICLOMATIC COMPLEXITY It is a software metric to measure quantitatively the logical complexity of a program. Under this approach that represents to work out the maximum number of independent paths of a program. According to this context, an independent path is any logical path that introduces new statements. In terms of a graph that means a new direct edge that has not been considered yet. This quantitative mesure give us an upper bound to the number of test cases.

WORKING OUT THE CICLOMATIC COMPLEXITY Some ways to work out the ciclomatic complexity: The ciclomatic complexity (V(G)) is equal to the numbers of region that compose the control flow graph. V(G)=A-N+2 Where A is the number of direct edge and is the number of nodes that compose the control flow graph. V(G)=P+1 Where P is the number of predicate nodes present on the control flow graph.

HOW TO OBTAIN THE TEST CASES The test cases are generated guaranting the execution of all the independent paths.

CICLOMATIC COMPLEXITY. INDEPENDENT PATHS 1 11 R 4 2,3 R 3 6 4,5 V(G)=4 Regions V(G)= 11A-9N+2=4 V(G)=3NP+1=4 7 8 R 2 R 1 9 Independent paths: Path 1: 1-11 Path 2: 1-2-3-4-5-10-1-11 Path 3: 1-2-3-6-8-9-10-1-11 Path 4: 1-2-3-6-7-9-10-1-11 10

EXAMPLE Design test cases by means of ciclomatic complexity metric for the following code: r:=0; if (x<0 or y<0) then writeln( x e y must be a positive number ) else begin r:=(x+y)/2; writeln( the average is:, r) end;

EXAMPLE BEGINNING 1 R=0 2 3 4 x<0 y<0 5 Writeln(...) R:=(x+y)/2 writeln(...) END 6

EXAMPLE. CONTROL FLOW GRAPH 1 F 2 T R 3 F 3 4 T R 5 R 2 4 1 6 V(g)=3 regions=3 V(g)=8A-7N+2=3 V(g)=2NP+1=3

EXAMPLE. INDEPENDENT PATHS Since the ciclomatic complexity is three, this code has three independent paths: C1: 1-2-4-6 C2: 1-2-3-4-5 C3: 1-2-3-5-6 Therefore the test cases associated to these independent paths are: C1: x<0 e (y irrelevant) C2: x 0 e y<0 C3: x 0 e y 0

EXAMPLE. INDEPENDENT PATHS C1 R=0 C3 x<0 y<0 Writeln(...) C2 R:=(x+y)/2 writeln(...)

BLACK BOX APPROACH TO DESIGN TEST CASES This approach considers the product functionality. Therefore the testing process is performed over the system interface. This approach reduce the number of test cases by means of selecting valid and invalid inputs,

SOME KIND OF DETECTED ERRORS Absent or incorrect functions Interface errors Data base access errors Data structure errors Performance errors Initialization and completion errors.

BLACK BOX TECHNIQUES Equivalence partitioning Boundary value Analysis

EQUIVALENCE PARTITIONING It consists in dividing the input data field into a set of data classes known as equivalence classes.

EQUIVALENCE CLASS CONCEPT An equivalence class is a input set of data defining both valid and invalid states of the system. Valid class: it generates an expected value. Invalid class: it generates an unexpected value. This division may be carried out by means of the input conditions described in the specification.

INPUT CONDITIONS An input condition may be expressed as an statement of the specificacion. An specific value A range of values A related set of values A logic condition..enter five values.....the values are between 0 and 10......Reserved words of a language......it must be...

THE PROCEDURE Identification of equivalence classes. Generation of test cases from the equivalence classes: An equivalence class may be represented by any of their element.

IDENTIFICATION OF EQUIVALENCE CLASSES For each input condition a valid and invalid equivalence class may be identified. This procedure is heuristic. However there are some criteria to make easy the identification procedure.

EQUIVALENCE CLASS IDENTIFICATION CRITERIA Input conditions Valid equivalence classes Invalid equivalence classes 1. Range of values 2. Specific values 3. A related set of values 4. Logic Condition 1 EC involving any value inside the range. 1 EC involving that specific value 1 EC for each element 1 EC satisfaying the logic condition 2 EC involving any value outside the range 2 EC involving two values, One above and one below wrt The specific value 1 EC representing one element outside the set of values 1 EC not satisfaying the logic condition

EQUIVALENCE CLASS TABLE The E. C. Table is the place where all the identified classes are described in order to find the different tets cases related to them. Input conditions Valid equivalence class Invalid equivalence class

HOW TO OBTAIN THE TEST CASES FROM THE E.C.? Valid equivalence classes: Each test case has to cover the maximum number of valid E.C. it implies to find the minimum number of test cases in order to cover all the valid E.C.. Generate a test case for each identified invalid equivalence class for avoiding hidden errors.

Example 1: Design a set of test cases to detect possible errors during the process of declaring an identifier taking into account the following syntactic rules of an hypothetic programming: The identifier must be between 5 and 15 characters long. These characters may be: Upper and lower cases Dígits (0,9) Dash (-) The system distiguishs between upper and lower cases. Dash may not be placed neither at the beggining nor at the end of an identifier. Several dashes may be placed consecutively inside the identifier Any identifier must contain, at least, one alphabetic character. The identifier may not be a reserved word of this programming language.

Recording the input conditions Input conditions Valid Equivalence classes Invalid equivalence classes -Between 5 and 15 characters long -These charcaters may be upper and lower cases, digits and dashes. -The system distiguishs between upper and lower cases -Dash may not be placed neither at the beggining nor at the end of an identifier -Several dashes may be placed consecutively inside the identifier - Any identifier must contain, at least, one alphabetic character -The identifier may not be a reserved word of this programming language

Recording the equivalence classes Input conditions Valid equivalence classes Invalid equivalence classes -Between 5 and 15 characters long - These charcaters may be upper and lower cases, digits and dashes. 1. 5 nº characters. 15 4. Characters of the identifier {letras, dígitos, guión} 2. nº characters<5 3. 15< nº characters 5. Some characters of the identifier {letras, dígitos, guión} -The system distiguishs between upper and lower cases -Dash may not be placed neither at the beggining nor at the end of an identifier -Several dashes may be placed consecutively inside the identifier -Any identifier must contain, at least, one alphabetic character - The identifier may not be a reserved word of this programming language 6. Declared identifier {Valid identifiers} 8. Identifiers withour dashes at the ends of these ones and presenting several consecutive dashes inside them 11. At least one alphabetic character is present on the identifier 13. Identifier {reserved words} 7. The same identifier but changing one character from upper to lower case or vicerversa 9. Identifier presenting a dash at the beggining 10. Identifier presenting a dash at the end 12. No alphabetic character is present on the identifier 14, 15, 16...One case for each reserved word.

Obtaining the test cases Identificador Num-1---d3 (10) Clases de equivalencia cubiertas 1,4,6,8,11,13 (regarding all the valid Equivalence classes) Resultado Identifier accepted by the system Nd3 2 Error message Num-1-letra3---d3 (17) 3 Error message Nu%m-1---d3 (11) 5 Error message NuM-1---d3 (10) 7 Error message -um-1---d3 (10) 9 Error message Num-1---d- (10) 10 Error message 456-1---23 (10) 12 Error Message Real 14 Error message..(the remaining reserved words).. 15,16... Error message

THE BOUNDARY VALUE ANALYSIS (BVA) BVA is based on the experimental evidency that errors are usually localized on the boundaries of input data fields. That kind of considerations enhances the test eficiency. Boundary conditions : these conditions represent values just above and below of one equivalence class.

GENERATING THE TEST CASES It supposes to generate as many test cases as it is necessary for considering all the boundary conditions. There are, as Equivalence partitioning, some heuristic criteria to facilitate the identification process

Input and output conditions Defining the test cases 1 case to consider the maximum value of the range 1. Range of values as an input condition 1 case to consider the minimum value of the range 1 case to consider just the value above the maximum 1 case to consider just the valuie below the minimum 1 case to consider the specific numeric value 2. An specific numeric value as an input condition. 1 case to consider just the value above the specific value 1 case to consider just the value below the specific value 3. Range of values as an output condition As in the item 1 4. An specific numeric value as an output condition. As in the item 2 5. A data structure as an output or input condition. 1 case to consider the first element of the data structure 1 case to consider the last element of the data structure

Example 2: Let us suppose a program that works out, given the sides, what kind of triangle it is. Triangle conditions: A+B>C and A+C>B and B+C>A According to the E.P. we should consider just one valid and invalid class. {A=4, B=5, C=3}, {A=1, B=2, C= 5} This approach would not detect an error as A+B C However BVA includes the case {A=1, B=2, C=3}

BVA applied to example 1 Condition Descriptions of test cases 1 case involving 15 charcaters Between 5 y 15 characters 1 case involving 5 characters 1 case involving 16 characters 1 case involving 4 characters Condition Test cases Num-1-let-3---d3 (15) Between 5 y 15 characters Numd3 (5) Num-1-letr-3---d3 (16) Nud3 (4)

SUMMARIZING The testing process consist in executing the program for detecting errors. The testing process is not exhaustive. The goal: reduce the number of test cases keeping up the efficiency. There are two approachs: Black box: take into account the functionality of the system. White box: take into account the internal logic

SUMMARIZING White box test case design techniques: Ciclomatic complexity:it is a software metric to measure quantitatively the logical complexity of a program. Black box test case design techniques: Equivalence partitioning: it divides the input data field into valid and invalid equivalence classes. Boundary value analysis: it consists in exercising the boundary condition of all the equivalence classes. A more effective black box testing process involves both techniques.