Agent program is the one part(class)of Othello program. How many test cases do you have to test? Reversi [Othello]

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.
Path Analysis Why path analysis for test case design?
Chapter 6 Path Testing Software Testing
1 Ivan Marsic Rutgers University LECTURE 15: Software Complexity Metrics.
CYCLOMATIC COMPLEXITY 1. Invented by Thomas McCabe (1974) to measure the complexity of a program ’ s conditional logic Cyclomatic complexity of graph.
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.
White Box Testing Techniques Dynamic Testing. White box testing(1) Source code is known and used for test design While executing the test cases, the internal.
IMSE Week 18 White Box or Structural Testing Reading:Sommerville (4th edition) ch 22 orPressman (4th edition) ch 16.
BASIS PATH TESTING ● By Tom McCabe ● McCabe, T., "A Software Complexity Measure," IEEE Trans. Software Engineering, vol. SE-2, December 1976, pp
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 3 Programming and Software.
Chapter 18 Testing Conventional Applications
Unit Testing CS 414 – Software Engineering I Don Bagert Rose-Hulman Institute of Technology January 16, 2003.
1 Software Testing Techniques CIS 375 Bruce R. Maxim UM-Dearborn.
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.
A Complexity Measure THOMAS J. McCABE Presented by Sarochapol Rattanasopinswat.
Cyclomatic Complexity Dan Fleck Fall 2009 Dan Fleck Fall 2009.
University of Toronto Department of Computer Science © 2001, Steve Easterbrook CSC444 Lec22 1 Lecture 22: Software Measurement Basics of software measurement.
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.
Agenda Introduction Overview of White-box testing Basis path testing
1 Software Testing. 2 Path Testing 3 Structural Testing Also known as glass box, structural, clear box and white box testing. A software testing technique.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 2 Chapter 2 - Introduction to C Programming.
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.
INTRUDUCTION TO SOFTWARE TESTING TECHNIQUES BY PRADEEP I.
Lecture 2: Logical Problems with Choices. Problem Solving Before writing a program Have a thorough understanding of the problem Carefully plan an approach.
1 Program Testing (Lecture 14) Prof. R. Mall Dept. of CSE, IIT, Kharagpur.
BASIS PATH TESTING.
1 Control Flow Analysis Topic today Representation and Analysis Paper (Sections 1, 2) For next class: Read Representation and Analysis Paper (Section 3)
White Box Testing Arun Lakhotia University of Southwestern Louisiana P.O. Box Lafayette, LA 70504, USA
Software Construction Lecture 19 Software Testing-2.
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.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 2 - Introduction to C Programming Outline.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 4: Introduction to C: Control Flow.
White Box Testing by : Andika Bayu H.
Cyclomatic complexity (or conditional complexity) is a software metric (measurement). Its gives the number of indepented paths through strongly connected.
Cyclomatic Complexity Philippe CHARMAN Last update:
 2003 Prentice Hall, Inc. All rights reserved. 1 Basic C++ Programming.
Dynamic White-Box Testing What is code coverage? What are the different types of code coverage? How to derive test cases from control flows?
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
White Box Testing. Agenda White-box vs Black-box Program Flow Controls White-box Test Methods Exercises Complexity Q&A.
1 Lecture 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line of Text 2.3Another Simple C Program: Adding.
BASIS PATH 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.
Control Flow Testing Handouts
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 4 Control Flow Testing
Cyclomatic complexity
Software Engineering (CSI 321)
Chapter 2 - Introduction to C Programming
Introduction To Flowcharting
Outline of the Chapter Basic Idea Outline of Control Flow Testing
Data Coverage and Code Coverage
Structural testing, Path Testing
Types of Testing Visit to more Learning Resources.
White Box Testing.
Chapter 2 - Introduction to C Programming
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Cyclomatic Complexity
Software Testing (Lecture 11-a)
Whitebox Testing.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Software Testing.
Software Testing and QA Theory and Practice (Chapter 5: Data Flow Testing) © Naik & Tripathy 1 Software Testing and Quality Assurance Theory and Practice.
Unit III – Chapter 3 Path Testing.
Presentation transcript:

Agent program is the one part(class)of Othello program. How many test cases do you have to test? Reversi [Othello]

Think again. This is program Reversi Brute force that have lines of code around 800 line. How complex is it. How many test cases at least do you want. Reversi [Othello]

Cyclomatic complexity defines, how much complex does our computer program is. Means, it defines the overall degree of hardness in working of our program by using control flow graph (we will talk with this topic later). One testing strategy called Basis path Testing ( by McCabe ) first proposed is to test each linearly independent path through the program; in this case, the number of test cases will equal the cyclomatic complexity of the program. How it is important?

White Box Testing White-box testing (also known as clear box testing, glass box testing, transparent box testing, and structural testing) is a method of testing software that tests internal structures or workings of an application, as opposed to its functionality (i.e. black-box testing). In white-box testing an internal perspective of the system, as well as programming skills, are required and used to design test cases. The tester chooses inputs to exercise paths through the code and determine the appropriate outputs. This is analogous to testing nodes in a circuit,black-box testing

CyVis is a free software metrics collection, analysis and visualisation tool for java based software. CyVis collects data from java class or jar files. Once the raw data is collected, certain metrics like number of lines, statements, methods, classes and packages are obtained. Other metrics like cyclomatic complexity etc. are also being deducted. What is CyVis?

Complex / No Complex A sequence of digits is obtained by writing down decimal representations of all integers starting with 1 and continuing up to a certain number N consecutively like this etc. Task Write a program that will compute the number of digits in such a sequence. Input The first and only line of input contains an integer N, 1 ≤ N ≤ 100,000,000. Output The first and only line of output should contain the number of digits in a sequence determined by the number given in the input.

Control flow graph

Sum = sum = 10; If (sum > 100) done = 1; Else done = 0; Endif sum > 100; sum = sum +10; done = 1;done = 0; End if How to do it by hands.

while (c) { x = y + 1; y = 2 * z; If(d) x = y + z; z = 1; } z = x; while (c) { x = y + 1; y = 2 * z; If(d) x = y + z; z = 1; } z = x; Example z = x While (c) x = y + 1; Y = 2 * Z If(d) x = y + 1; Y = 2 * Z If(d) x = y +z z = 1

Cyclomatic complexity is a software metric. It was developed by Thomas J. McCabe, Sr. in 1976 and is used to indicate the complexity of a program. It directly measures the number of linearly independent paths through a program's source code. The concept, although not the method, is somewhat similar to that of general text complexity measured by the Flesch-Kincaid Readability Test. Definition of Complexity

Cyclomatic complexity is computed using the control flow graph of the program: the nodes of the graph correspond to indivisible groups of commands of a program, and a directed edge connects two nodes if that second command might be executed immediately after the first command. Cyclomatic ecomplexity may also be applied to individual functions, modules, methods or classes within a program. Definition of Complexity

The cyclomatic complexity of a section of source code is the count of the number of linearly independent paths through the source code. For instance, if the source code contained no decision points such as IF statements or FOR loops, the complexity would be 1, since there is only a single path through the code. If the code had a single IF statement containing a single condition there would be two paths through the code, one path where the IF statement is evaluated as TRUE and one path where the IF statement is evaluated as FALSE.pathssource code Definition of Complexity

Cyclomatic complexity is defined for each module to be E - N + 2, where E and N are the number of edges and nodes in the control flow graph, respectively. Cyclomatic complexity is also known as v(G), where v refers to the cyclomatic number in graph theory and G indicates that the complexity is a function of the graph. Definition of Complexity number

Mathematically, the cyclomatic complexity of a structured program is defined with reference to the control flow graph of the program, a directed graph containing the basic blocks of the program, with an edge between two basic blocks if control may pass from the first to the second. The complexity M is then defined as : Where E = the number of edges of the graph N = the number of nodes of the graph P = the number of connected components M = E − N + 2P Control flow graph

A control flow graph of a simple program. The program begins executing at the red node, then enters a loop (group of three nodes immediately below the red node). On exiting the loop, there is a conditional statement (group below the loop), and finally the program exits at the blue node. For this graph E = 9, N = 8 and P = 1 so the complexity of the program is (2*1) = 3 M = E − N + 2P Control flow graph

An alternative formulation is to use a graph in which each exit point is connected back to the entry point M = E − N + P The function shown as a strongly connected control flow graph, calculation via alternative method. For this graph E = 10, N = 8 and P = 1 so the cyclomatic complexity of the program is = 3 Control flow graph

Basic block is a portion of the code within a program with certain desirable properties that make it highly amenable to analysis. Compilers usually decompose programs into their basic blocks as a first step in the analysis process. Basic blocks form the vertices or nodes in a control flow graph. Compilerscontrol flow graph The code in a basic block has: one entry point, meaning no code within it is the destination of a jump instruction anywhere in the program one exit point, meaning only the last instruction can cause the program to begin executing code in a different basic block.jump instruction Control flow graph

Question Cyclometric complexity is tool to measure density of the program. TRUE or FALSE? Cyclometric complexity is tools to measure how the program complex. (not density) Answer QUIZ

Which one is the formula of complexity number? M = E − N + P P = E − N + M M = N + E - P M = E + N + 2P A.) B.) C.) D.) QUIZ Comment Uwe: Attention: Please consider. Formula following ISTQB: M = L – N + 2P, where – L = number of edges/links in a graph – N = number of nodes in a graph – P = number of disconnected parts of the graph (e.g. a called graph or subroutine). Only in the strongly connected graph the formula is M = L – N + P.

Transform this code to control flow graph. if( c1() ) f1(); else f2(); if( c2() ) f3(); else f4(); QUIZ

In this graph calculate M by using formula of Control flow. M = E − N + P M = 8 – M = 2 QUIZ Comment Uwe: Attention: There are 9 edges / links in the strongly connected graph – that’s why: M = 9 – = 2

Which one have more complexity number ? M = E − N + 2P M = 4 − M = 2 M = 5 – M =2 QUIZ Comment Uwe: Attention: There are 6 edges / links in the right graph – that’s why: M = 6 – = 3

Summary Show the complex program.(Agent and Reversi programs. How many test cases that they have to test? How Cyclometric Complexity is important. What is Complex number program. (CyVis) How to do it by hands. (Control flow graph) Definition.

In software testing life we cannot read by your eyes to determine how many test cases that you want. That’s make you less efficient. You can use Cyclometric complexity to measure how program complex is. By using program CyVis or another program to measure complexity. In real life you cant trust all of complexity number 99% you can trust and 1% you cannot trust it. In switch cases it’s count 1 case to 1 Summary

const String weekDayName(const int number) { switch(number) { case 1: return "Monday"; case 2: return " Tuesday"; case 3: return "Wednesday"; case 4: return "Thursday"; case 5: return "Friday"; case 6: return "Saturday"; case 7: return "Sunday"; } return "unknown weekday"; } const String weekDayName(const int number) { switch(number) { case 1: return "Monday"; case 2: return " Tuesday"; case 3: return "Wednesday"; case 4: return "Thursday"; case 5: return "Friday"; case 6: return "Saturday"; case 7: return "Sunday"; } return "unknown weekday"; } Switch case Ex