Structure Based Test Design

Slides:



Advertisements
Similar presentations
Chapter 4 - Control Statements
Advertisements

Path Analysis Why path analysis for test case design?
Chapter 6 Path Testing Software Testing
White Box and Black Box Testing Tor Stålhane. What is White Box testing White box testing is testing where we use the info available from the code of.
Unit Testing CS 4311 Hans Van Vliet, Software Engineering, Principles and Practice, 3rd edition, John Wiley & Sons, Chapter 13.
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.
Selection (decision) control structure Learning objective
Understanding the Three Basic Structures
Tutorial #6 PseudoCode (reprise)
Objectives AND logic OR logic Evaluating compound conditions with multiple logical operators Precedence when combining AND and OR operators Efficiency.
CMSC 345, Version 11/07 SD Vick from S. Mitchell Software Testing.
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.
BASIS PATH TESTING ● By Tom McCabe ● McCabe, T., "A Software Complexity Measure," IEEE Trans. Software Engineering, vol. SE-2, December 1976, pp
SOFTWARE TESTING WHITE BOX TESTING 1. GLASS BOX/WHITE BOX TESTING 2.
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.
CMSC 345 Fall 2000 Unit Testing. The testing process.
Programming Logic and Design Sixth Edition
CS4311 Spring 2011 Unit Testing Dr. Guoqiang Hu Department of Computer Science UTEP.
Chapter 3 Making Decisions
Designing Programs with Branches CSIS 1595: Fundamentals of Programming and Problem Solving 1.
Reference Paulo Alencar, University of Waterloo Frank Tsui, Southern Polytechnic State University.
Selection Control Structures Simple Program Design Third Edition A Step-by-Step Approach 4.
Software Testing. 2 CMSC 345, Version 4/12 Topics The testing process  unit testing  integration and system testing  acceptance testing Test case planning.
By the end of this session you should be able to...
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Flowcharts.
Lec 06 Path Testing Part II - 1 CSCE 747 Fall 2013 CSCE 747 Software Testing and Quality Assurance Lecture 06 – Path Testing Part II 9/16/
Selection Control Structures. Simple Program Design, Fourth Edition Chapter 4 2 Objectives In this chapter you will be able to: Elaborate on the uses.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley STARTING OUT WITH Python Python First Edition by Tony Gaddis Chapter 4 Decision.
1 Boolean Expressions to Make Comparisons Boolean expression –Represents only one of two states –Expression evaluates to either true or false Expressions.
CHAPTER 4: Selection Control Structure. Objectives  Use the relational comparison operators  Learn about AND logic  Learn about OR logic  Make selections.
Summarizing “Structural” Testing Now that we have learned to create test cases through both: – a) Functional (blackbox)and – b) Structural (whitebox) testing.
BACS 287 Programming Logic 2. BACS 287 Sequence Construct The sequence construct is the default execution mode for the CPU. The instructions are executed.
Chapter 8 Path Testing. Path testing Path testing is a “design structural testing” in that it is based on detailed design & the source code of the program.
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
Programming Logic and Design, Introductory, Fourth Edition1 Understanding the Three Basic Structures Structure: a basic unit of programming logic Any program.
SOFTWARE TESTING. Introduction Software Testing is the process of executing a program or system with the intent of finding errors. It involves any activity.
CS 127 Exceptions and Decision Structures. Exception Handling This concept was created to allow a programmer to write code that catches and deals with.
Algorithms and Pseudocode
White-Box Testing Techniques I Prepared by Stephen M. Thebaut, Ph.D. University of Florida Software Testing and Verification Lecture 7.
CSC 395 – Software Engineering Lecture 27: White-Box Testing.
Dynamic White-Box Testing What is code coverage? What are the different types of code coverage? How to derive test cases from control flows?
Control Structure  What is control Structure?  Types of Controls  Use the control structure in VBScript.  Example Summery.
Programming Logic and Design Fifth Edition, Comprehensive Chapter 4 Making Decisions.
Control Structures: Conditionals, If/Else and Loops David Millard
Software TestIng White box testing.
Output “Funds not available”
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 Engineering (CSI 321)
Sequence, Selection, Iteration The IF Statement
Data Coverage and Code Coverage
White-Box Testing Techniques
Types of Testing Visit to more Learning Resources.
CHAPTER 4 Test Design Techniques
UNIT-4 BLACKBOX AND WHITEBOX TESTING
More Selections BIS1523 – Lecture 9.
CIS 4932 Software Testing White-Box Testing
Understanding the Three Basic Structures
Solution to problem 4. a) Control flow graph art Start k = i + 2 * j
White-Box Testing Techniques I
Computational Thinking
Boolean Expressions to Make Comparisons
Program Flow.
There many situations comes in real life when we need to make some decisions and based on these decisions, we decide what should we do next. Similar situations.
1. Cyclomatic complexity
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Unit III – Chapter 3 Path Testing.
Presentation transcript:

Structure Based Test Design Given the Following program IF X < Y THEN Statement 1; ELSE IF Y >= Z THEN Statement 2; END   McCabe’s Cyclomatic Complexity is : a. 2 b. 3 c. 4 d. 5

Structure Based Test Design Given the following code, which is true about the minimum number of test cases required for full statement and branch coverage:   Read P Read Q IF P+Q > 100 THEN Print “Large” ENDIF If P > 50 THEN Print “P Large” 1 test for statement coverage, 3 for branch coverage 1 test for statement coverage, 2 for branch coverage 1 test for statement coverage, 1 for branch coverage 2 tests for statement coverage, 3 for branch coverage 2 tests for statement coverage, 2 for branch coverage

Structure Based Test Design Given the following:   Switch PC on Start “outlook” IF outlook appears THEN Send an email Close outlook 1 test for statement coverage, 1 for branch coverage 1 test for statement coverage, 2 for branch coverage 1 test for statement coverage. 3 for branch coverage 2 tests for statement coverage, 2 for branch coverage 2 tests for statement coverage, 3 for branch coverage

Structure Based Test Design Given the following code, which is true:   IF A > B THEN C = A – B ELSE C = A + B ENDIF Read D IF C = D Then Print “Error” 1 test for statement coverage, 3 for branch coverage 2 tests for statement coverage, 2 for branch coverage 2 tests for statement coverage. 3 for branch coverage 3 tests for statement coverage, 3 for branch coverage 3 tests for statement coverage, 2 for branch coverage

Structure Based Test Design Consider the following: Pick up and read the newspaper Look at what is on television If there is a program that you are interested in watching then switch the television on and watch the program Otherwise Continue reading the newspaper If there is a crossword in the newspaper then try and complete the crossword   SC = 1 and DC = 1 SC = 1 and DC = 2 SC = 1 and DC = 3 SC = 2 and DC = 2 SC = 2 and DC = 3

Structure Based Test Design Analyze the following highly simplified procedure: Ask: “What type of ticket do you require, single or return?” IF the customer wants ‘return’ Ask: “What rate, Standard or Cheap-day?” IF the customer replies ‘Cheap-day’ Say: “That will be £11:20” ELSE Say: “That will be £19:50” ENDIF Say: “That will be £9:75”   Now decide the minimum number of tests that are needed to ensure that all the questions have been asked, all combinations have occurred and all replies given. 3 4 5 6

Structure Based Test Design If the pseudo-code below were a programming language, how many tests are required to achieve 100% statement coverage? If x=3 then Display_messageX; If y=2 then Display_messageY; Else Display_messageZ;   a. 1 b. 2 c. 3 d. 4

Structure Based Test Design If x=3 then Display_messageX; If y=2 then Display_messageY; Else Display_messageZ;   Using the same code example as above as question, how many tests are required to achieve 100% branch/decision coverage? a. 1 b. 2 c. 3 d. 4

Structure Based Test Design How many test cases are needed to achieve 100% decision coverage   If (p = q)‏ { S = S + 1; If (S < 5)‏ { t = 10 } } Else if (P > q )‏ { T = 5 } A. 3 B. 6 C. 5 D.4

Structure Based Test Design How many test cases are necessary to cover all the possible sequences of statements (paths) for the following program fragment? Assume that the two conditions are independent of each other: -   if (Condition 1) then statement 1  else statement 2 if (Condition 2) then statement 3 a. 2 Test Cases b. 3 Test Cases c. 4 Test Cases d. Not achievable

Structure Based Test Design How many test cases are necessary to cover all the possible sequences of statements (paths) for the following program fragment? Assume that the two conditions are independent of each other: -   if (Condition 1) then statement 1  else statement 2 if (Condition 2) then statement 3 a. 2 Test Cases b. 3 Test Cases c. 4 Test Cases d. Not achievable

Structure Based Test Design How many test cases are needed to achieve 100% statement coverage? If ( ( temperature < 0) or ( temperature > 100)) { alert (“DANGER”); if ( (speed >100) and (load <= 50)) { speed = 50; } } else { Check = false; 5 4 2 3