Https://flic.kr/p/9AWLK White-Box 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

The If Then Else Statement Using JavaScript TIP The If Statement is the fundamental control structure that allows branches in the flow of control in a.
Marking Schema question1: 40 marks question2: 40 marks question3: 20 marks total: 100 marks.
Systems V & V, Quality and Standards
Lesson 5 - Decision Structure By: Dan Lunney
White Box Testing and Symbolic Execution Written by Michael Beder.
1 “White box” or “glass box” tests “White Box” (or “Glass Box”) Tests.
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.
16/27/2015 3:38 AM6/27/2015 3:38 AM6/27/2015 3:38 AMTesting and Debugging Testing The process of verifying the software performs to the specifications.
Tutorial 4 Decision Making with Control Structures and Statements Section A - Decision Making JavaScript Tutorial 4 -Decision Making with Control.
Software Testing and QA Theory and Practice (Chapter 4: Control Flow Testing) © Naik & Tripathy 1 Software Testing and Quality Assurance Theory and Practice.
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
White-Box Testing Eshcar Hillel Michael Beder. White Box Testing 2 Tutorial Outline What is White Box Testing? Flow Graph and Coverage Types Symbolic.
CS4311 Spring 2011 Unit Testing Dr. Guoqiang Hu Department of Computer Science UTEP.
CS4311 Spring 2011 Unit Testing Dr. Guoqiang Hu Department of Computer Science UTEP.
1. We’ve learned that our programs are read by the compiler in order, from top to bottom, just as they are written The order of statement execution is.
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.
White-box Testing.
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UWA WELLASSA 1 ‏ Control Structures.
1 Program Testing (Lecture 14) Prof. R. Mall Dept. of CSE, IIT, Kharagpur.
WHITE BOX TESTING IS4500 Copyright © 2012 by The Cathris Group and Martin J. Schedlbauer. All Rights Reserved. Do Not Duplicate or Distribute Without Written.
Agent program is the one part(class)of Othello program. How many test cases do you have to test? Reversi [Othello]
CPS120: Introduction to Computer Science Decision Making in Programs.
CSI 3125, Preliminaries, page 1 Control Statements.
1 Test Coverage Coverage can be based on: –source code –object code –model –control flow graph –(extended) finite state machines –data flow graph –requirements.
Conditional statements and boolean expressions Arithmetic, relational and logical operators.
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
Verification vs. Validation Verification: "Are we building the product right?" The software should conform to its specification.The software should conform.
CS223: Software Engineering Lecture 26: Software Testing.
Week 5-6 MondayTuesdayWednesdayThursdayFriday Testing I No reading Group meetings MidtermNo Section Testing II Progress report due Readings out 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
Software Engineering (CSI 321)
Software Testing and Maintenance 1
Outline of the Chapter Basic Idea Outline of Control Flow Testing
Structural testing, Path Testing
Control Flow based Testing
Types of Testing Visit to more Learning Resources.
White Box Testing.
Expressions and Control Flow in JavaScript
Testing Approaches.
White-Box Testing.
White-Box Testing Techniques II
Control Structures.
Microsoft Visual Basic 2005 BASICS
Dataflow Testing G. Rothermel.
Testing, conclusion Based on material by Michael Ernst, University of Washington.
White-Box Testing Techniques III
Program Slicing Baishakhi Ray University of Virginia
Software Testing (Lecture 11-a)
White-Box Testing Techniques II
“White box” or “glass box” tests
White-Box Testing.
Executes a block of statements only if a test is true
Computers & Programming Languages
Scratch: selection / branching/ if / If…else / compound conditionals / error trapping by Mr. Clausen.
White-Box Testing Techniques III
Visual Basic – Decision Statements
Sudipto Ghosh CS 406 Fall 99 November 16, 1999
Computer Science Core Concepts
White-Box Testing Techniques II
Whitebox Testing.
White-Box Testing.
Whitebox Testing.
Software Testing.
Unit III – Chapter 3 Path Testing.
Presentation transcript:

https://flic.kr/p/9AWLK White-Box Testing

Recall: Common ways to choose test cases Black-box testing White-box testing Regression testing

White-Box Testing Uses internal logic to choose tests Different levels of code coverage Example: Cover all statements Aka glass box testing, clear box testing

To compute these, you need… Code Coverage Degree to which source code of a program is tested by a test suite Examples: Statement coverage Branch coverage Path coverage There are more types of coverages To compute these, you need…

Control Flow Graph (CFG) Represents possible control paths through code: Given some code: def create @profile = profile.new(params) if @profile.save redirect_to show_prof_url(@profile) else render ‘new’ end

How to construct a CFG Step 1: Identify basic blocks Straight-line pieces of code without any jumps or jump targets def create @profile = profile.new(params) if @profile.save redirect_to show_prof_url(@profile) else render ‘new’ end }

How to construct a CFG Step 2: Model the jumps (control branches) as directed lines @profile = profile.new(params) if @profile.save true false redirect_to show_prof_url(@profile) else render ‘new’ end

How to construct a CFG Step 3: Model entry and exit (return) points @profile = profile.new(params) if @profile.save true redirect_to show_prof_url(@profile) false else render ‘new’ end

How to construct a CFG Now you have a CFG! @profile = profile.new(params) if @profile.save true redirect_to show_prof_url(@profile) false else render ‘new’ end

Code Coverage Levels Statement coverage Branch 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 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

Define a test suite that provides statement coverage 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

Code Coverage Levels Statement coverage Branch coverage Path coverage

Branch 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 branch coverage 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

Define a test suite that provides branch coverage 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

Code Coverage Levels Statement coverage Branch 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 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

Define a test suite that provides path coverage 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 ✔ ✔

Coverage Support Tools Visual Studio https://msdn.microsoft.com/en-us/library/dd537628.aspx

Coverage Support Tools SimpleCov Ruby Gem

Coverage Support Tools SimpleCov Ruby Gem

Recap White-box testing Control Flow Graph (CFG) Code Coverage Statement Branch Path