Https://flic.kr/p/9AWLK Whitebox Testing.

Slides:



Advertisements
Similar presentations
Decision Structures - If / Else If / Else. Decisions Often we need to make decisions based on information that we receive. Often we need to make decisions.
Advertisements

Marking Schema question1: 40 marks question2: 40 marks question3: 20 marks total: 100 marks.
Whitebox Testing Fra: CS Fall Whitebox Testing AKA Structural, Basis Path Test Normally used at unit level Assumes errors at unit level are.
Python Programming Language
Annoucements  Next labs 9 and 10 are paired for everyone. So don’t miss the lab.  There is a review session for the quiz on Monday, November 4, at 8:00.
Selection (decision) control structure Learning objective
Testing, cont. Based on material by Michael Ernst, University of Washington.
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.
Software Testing and Quality Assurance
Software Testing and Quality Assurance White Box Testing.
16/27/ :53 PM6/27/ :53 PM6/27/ :53 PMLogic Control Structures Arithmetic Expressions Used to do arithmetic. Operations consist of +,
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
System/Software Testing
White-Box Testing Eshcar Hillel Michael Beder. White Box Testing 2 Tutorial Outline What is White Box Testing? Flow Graph and Coverage Types Symbolic.
Path Testing + Coverage Chapter 9 Assigned reading from Binder.
Course Outline Traditional Static Program Analysis –Theory –Classic analysis and applications Points-to analysis, CHA, RTA –The Soot analysis framework.
1 Conditions Logical Expressions Selection Control Structures Chapter 5.
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.
Testing Testing Techniques to Design Tests. Testing:Example Problem: Find a mode and its frequency given an ordered list (array) of with one or more integer.
White-box Testing.
CS 217 Software Verification and Validation Week 7, Summer 2014 Instructor: Dong Si
1 2. Program Construction in Java. 2.4 Selection (decisions)
1 Program Testing (Lecture 14) Prof. R. Mall Dept. of CSE, IIT, Kharagpur.
Agent program is the one part(class)of Othello program. How many test cases do you have to test? Reversi [Othello]
CS122 – Quiz 2 Winter, 2013 Quiz Hints. Quiz 2 Hints Question 1 – working with the “if” statement  First, we did not fully explain the structure of the.
1 Test Coverage Coverage can be based on: –source code –object code –model –control flow graph –(extended) finite state machines –data flow graph –requirements.
Dynamic White-Box Testing What is code coverage? What are the different types of code coverage? How to derive test cases from control flows?
Conditional Statements A conditional statement lets us choose which statement will be executed next Conditional statements give us the power to make basic.
White-Box Testing Statement coverage Branch coverage Path coverage
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
Testing (final thoughts). equals() and hashCode() Important when using Hash-based containers class Duration { public final int min; public final int sec;
CS223: Software Engineering Lecture 26: Software Testing.
White Box Testing. Agenda White-box vs Black-box Program Flow Controls White-box Test Methods Exercises Complexity Q&A.
Week 5-6 MondayTuesdayWednesdayThursdayFriday Testing I No reading Group meetings MidtermNo Section Testing II Progress report due Readings out Testing.
Software Testing.
Software 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
The switch Statement, and Introduction to Looping
Software Testing and Maintenance 1
Outline of the Chapter Basic Idea Outline of Control Flow Testing
Structural testing, Path Testing
White-Box Testing Techniques
Types of Testing Visit to more Learning Resources.
White-Box Testing.
White-Box Testing.
Control Structures.
Introduction to MATLAB
Microsoft Visual Basic 2005 BASICS
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Testing, conclusion Based on material by Michael Ernst, University of Washington.
White-Box Testing Techniques III
Software Testing (Lecture 11-a)
Cause and Effect Graphing
White-Box Testing.
CSCI 3328 Object Oriented Programming in C# Chapter 5: C# Control Statement – Part II – Exercises UTPA – Fall 2012 This set of slides is revised from.
Graph Coverage for Source Code
Find the reference angle for the angle measuring {image}
Coursework 1 Due Tuesday, Feb 6, 2007 in the tutorial
White-Box Testing.
Paul Ammann & Jeff Offutt
Whitebox Testing.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Lesson 3. Controlling program flow. Loops. Methods. Arrays.
Software Testing.
Given that {image} {image} Evaluate the limit: {image} Choose the correct answer from the following:
Unit III – Chapter 3 Path Testing.
Presentation transcript:

https://flic.kr/p/9AWLK Whitebox Testing

Recall: Approaches to choose test cases Blackbox testing: Choose based on module’s possible inputs and outputs Do not use code Often test boundary cases Whitebox testing: Uses internal logic to choose tests Different levels of code coverage Aka glass box testing, clear box testing

Code Coverage Degree to which source code of a program is tested by a test suite Examples: Statement coverage Condition coverage Path coverage There are more types of coverages But first…

Control Flow Graphs def create @profile = profile.new(params) if @profile.save redirect_to show_prof_url(@profile) else render ‘new’ end } Basic blocks: straight-line pieces of code without any jumps or jump targets

Control Flow Graphs Jumps: control branches def create end @profile = profile.new(params) if @profile.save TRUE redirect_to show_prof_url(@profile) FALSE else render ‘new’ end Jumps: control branches

QUIZ!

In the control flow graph given, which of the following is not a basic block? (Hint: Basic block = no jumps) Option 1: 1 Option 2: 2 Option 3: 3 Option 4: 4

2. Which of the execution arrows is not in the correct place for this control flow graph? Option 1: 1 Option 2: 2 Option 3: 3 Option 4: 4

3. Which of the following will execute the correct jumps for (1) and (2)? Option 1: (1):true, (2):true Option 2: (1):true, (2):false Option 3: (1):false, (2):false Option 4: (1):false, (2):true

Answers Option 2: 2 Option 3: 3 Option 2: (1):true, (2):false

Code Coverages Statement coverage Condition coverage Path coverage

Statement Coverage Set of test cases such that… Each program statement (line or basic block) is executed at least once

Define a test suite that provides statement coverage Control Flow Graph def foo(x, y) @z = 0 if x > 0 && y > 0 @z = x end return @z @z = 0 if x > 0 && y > 0 @z = x return @z ✔ true ✔ false input expected x y ✔ 1 1 1

QUIZ!

1. Fill in the blank: The test suite for statement coverage means that each _______ is executed at least once. Option 1: Conditions Option 2: Jump Option 3: Basic Block Option 4: None of the above

True or False? All the statements in the CFG is covered with this array of inputs: { (x,y): (40,4), (40,30) }.

3. Which of the following input array will provide full statement coverage for the image? Option 1: { (x,y): (10,10), (10,18) } Option 2: { (x,y): (20,10), (20,21) } Option 3: { (x,y): (30,10) } Option 4: { (x,y): (23,8), (10,21) }

Answers Option 3: Basic Block True; if you trace with the inputs, it hits all the statements Option 2: { (x,y): (20,10), (20,21) }

Code Coverages Statement coverage Condition coverage Path coverage

Condition Coverage Set of test cases such that… Each boolean expression (in control structures) evaluates to true at least once and to false at least once

Define a test suite that provides condition coverage Control Flow Graph def foo(x, y) @z = 0 if x > 0 && y > 0 @z = x end return @z @z = 0 if x > 0 && y > 0 @z = x return @z ✔ true ✔ false input expected x y 1 1 1 0 0 0

QUIZ!

1. Explain why { (x,y): (23,4), (10,20) } may or may not achieve condition coverage for this CFG.

2. This table is incomplete for the control flow graph given 2. This table is incomplete for the control flow graph given. Which input would help achieve condition coverage? Option 1: 10, 10 Option 2: 20, 20 Option 3: 10, 30 Option 4: None of the above input x y 40 30 ?

3. True or False? The following inputs will provide condition coverage for the code = {(a,b):(4,11),(4,20)}

Answers The inputs will never reach the true condition right above “break;” Option 1: 10, 10 False, the inputs will never reach the false condition

Code Coverages Statement coverage Condition coverage Path coverage

Path Coverage Set of test cases such that… Each possible path through a program’s control flow graph is taken at least once

Define a test suite that provides path coverage Control Flow Graph def foo(x, y) @z = 0 if x > 0 && y > 0 @z = x end return @z @z = 0 if x > 0 && y > 0 @z = x return @z true (a) (c) false (b) input expected x y 1 1 1 Paths: a, b c 0 0 0 ✔ ✔

Final quiz QUIZ!

1. Which of the following is not a possible path of the control flow graph? Option 1: a, f, h Option 2: b, c, a, g, i Option 3: b, d, e, g, h Option 4: a, g, i

2. Given the possible paths, which one is missing. Use previous cfg 2. Given the possible paths, which one is missing? Use previous cfg. Option 1: a, g, h Option 2: b, d, e, g Option 3: b, c, a, f, h Option 4: None of the above

3. What inputs will cover the a, g, i path? Option 1: {(x,y): (6,5)} Option 2: {(x,y): (6,21)} Option 3: {(x,y): (5,5)} Option 4: None of the above 4. What inputs will cover the b, c, a, f,h path? Option 1: {(x,y): (12,8)} Option 2: {(x,y): (11,25)} Option 3: {(x,y): (12,10)} Option 4: {(x,y): (20,8)}

Answers Option 3: b, d, e, g, h Option 3: b, c, a, f, h Option 1: {(x,y): (6,5)} Option 2: {(x,y): (11,25)}

Think, Pair, Share Control Flow Graph def bar(x) @result=0; if (x < 69) if (x % 2 == 0) @result = x/2; else @result = x*2; end x = 6969; return @result; Think, Pair, Share Control Flow Graph @result=0; @result = x*2; (a) (f) F T x < 69 x % 2 == 0 (h) (e) (g) T F (b) @result = x/2; (i) T x >= 69 x = 6969 return @result; (c) (d)

1. Given the CFG, provide the minimum inputs to achieve statement coverage. Answer format should look like this: (input, next input,…). 2. Use the same image to provide the minimum inputs and expected output to achieve condition coverage. Again, the answer format should look like this: (input, output); (input,output)…etc. 3. For path coverage, list the possible paths and provide the minimum inputs/outputs that will cover the paths. Here is the format you should use: Path=(a,b,c),(c,d,e)… / I/O=(43,3),(34,3)… (No answer provided…)

What We Covered Control Flow Graphs (CFG) Code Coverage Statement Condition Path