Http://flic.kr/p/7iffKj Software Testing.

Slides:



Advertisements
Similar presentations
Software Testing. Quality is Hard to Pin Down Concise, clear definition is elusive Not easily quantifiable Many things to many people You'll know it when.
Advertisements

Chapter 14 Testing Tactics
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
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.
CS 111: Introduction to Programming Midterm Exam NAME _________________ UIN __________________ 10/30/08 1.Who is our hero? 2.Why is this person our hero?
1 “White box” or “glass box” tests “White Box” (or “Glass Box”) Tests.
IMSE Week 18 White Box or Structural Testing Reading:Sommerville (4th edition) ch 22 orPressman (4th edition) ch 16.
CS 425/625 Software Engineering Software Testing
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.
Testing an individual module
Software Testing. “Software and Cathedrals are much the same: First we build them, then we pray!!!” -Sam Redwine, Jr.
1 Joe Meehean. 2 Testing is the process of executing a program with the intent of finding errors. -Glenford Myers.
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
System/Software Testing
Testing. Definition From the dictionary- the means by which the presence, quality, or genuineness of anything is determined; a means of trial. For software.
CS4311 Spring 2011 Unit Testing Dr. Guoqiang Hu Department of Computer Science UTEP.
Path Testing + Coverage Chapter 9 Assigned reading from Binder.
Contents Introduction Requirements Engineering Project Management
1 Software testing. 2 Testing Objectives Testing is a process of executing a program with the intent of finding an error. A good test case is in that.
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.
Unit Testing 101 Black Box v. White Box. Definition of V&V Verification - is the product correct Validation - is it the correct product.
16 October Reminder Types of Testing: Purpose  Functional testing  Usability testing  Conformance testing  Performance testing  Acceptance.
1 Phase Testing. Janice Regan, For each group of units Overview of Implementation phase Create Class Skeletons Define Implementation Plan (+ determine.
1 Program Testing (Lecture 14) Prof. R. Mall Dept. of CSE, IIT, Kharagpur.
SOFTWARE TESTING. INTRODUCTION Testing forms the first step in determining the errors in a program. It is the major quality control measure used during.
Agent program is the one part(class)of Othello program. How many test cases do you have to test? Reversi [Othello]
1 Test Coverage Coverage can be based on: –source code –object code –model –control flow graph –(extended) finite state machines –data flow graph –requirements.
CSC 395 – Software Engineering Lecture 27: White-Box Testing.
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.
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.
Software TestIng White box testing.
Software Testing.
Software Testing.
Topic: Recursion – Part 2
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
Software Engineering (CSI 321)
Software Testing and Maintenance 1
CompSci 230 Software Construction
Software Testing.
Outline of the Chapter Basic Idea Outline of Control Flow Testing
Software engineering – 1
Structural testing, Path Testing
Types of Testing Visit to more Learning Resources.
White-Box Testing.
White-Box Testing.
Microsoft Visual Basic 2005 BASICS
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Dataflow Testing G. Rothermel.
Testing, conclusion Based on material by Michael Ernst, University of Washington.
Software Testing (Lecture 11-a)
Verification and Validation Unit Testing
“White box” or “glass box” tests
White-Box Testing.
Software testing.
CS240: Advanced Programming Concepts
Chapter 10 – Software Testing
Sudipto Ghosh CS 406 Fall 99 November 16, 1999
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Whitebox Testing.
White-Box Testing.
Whitebox Testing.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Unit III – Chapter 3 Path Testing.
Presentation transcript:

http://flic.kr/p/7iffKj Software Testing

SWEBOK Knowledge Areas Software Requirements Software Design Software Construction Software Testing Software Maintenance Software Configuration Management Software Engineering Management Software Engineering Process Software Engineering Models and Methods Software Quality Software Engineering Professional Practice Software Engineering Economics Computing Foundations Mathematical Foundations Engineering Foundations Today’s topic

Can you create bug-free software? In real software, there are hundred of lines so it is very difficult to create a program that is 100% bug free.

Can you create bug-free software? For practical purposes, no! Goal: Reduce the number of bugs In real software, there are hundred of lines so it is very difficult to create a program that is 100% bug free.

Can you create bug-free software? What can you do to discover bugs? For practical purposes, no! Goal: Reduce the number of bugs In real software, there are hundred of lines so it is very difficult to create a program that is 100% bug free.

Can you create bug-free software? What can you do to discover bugs? For practical purposes, no! Goal: Reduce the number of bugs In real software, there are hundred of lines so it is very difficult to create a program that is 100% bug free. Most common ways in practice: Software testing Code reviews

Testing-Related Terminology Testing: Execute code to reveal defects Given some input, does it produce expected output? Does it behave as expected? Test/Test Case: One execution of code that may expose bug Test Suite: Set of test cases Often used to group related tests

How do you completely test a program? Think of simple example: UNIX file operation Takes file name as argument Each character an 8-bit byte

How do you completely test a program? Think of simple example: UNIX file operation Takes file name as argument Each character an 8-bit byte Exhaustive Testing: Try all possible inputs

Can exhaustive testing be done in practice?

Can exhaustive testing be done in practice? No! How many tests cases to exhaustively test simple UNIX file command? If you limit file name to 10 characters, there are 25610 different test cases Even if you can run 1000 tests per second, it would still take over 1013 years! And that's just varying the file's name, not its contents!! Clearly, exhaustive testing not feasible… =((2^8)^10)/(1000*60*60*24*365)

How to choose set of test cases that reveals all errors? The Testing Problem: How to choose set of test cases that reveals all errors? Fundamental research problem Essentially unsolvable in general case

Design Decisions for Tests What subset of system to test? How to choose test cases?

What subset of system to test? larger subset System testing: Test the complete system Integration testing: Test groups of collaborating units Unit testing: Test modules in isolation; smallest “units” of code smaller subset

Unit versus Integration Testing Problem: Definition of “unit” varies (class? method?) Common distinctions: Unit test Integration test Repeatable (context independent) May involve system time, machine name, etc. Deterministic May involve threads, random numbers, etc. In memory May involve file system, DB Fast (less than 0.5 seconds) May be slow Tests one property May test multiple properties

Design Decisions for Tests What subset of system to test? How to choose test cases?

Two common ways to choose test cases Black-box testing White-box testing

Black-Box Testing Choose based on module’s possible inputs and outputs (i.e., its interface) Do not use internal code Often test boundary cases Example: Values at 0, 1, and -1 (around the zero boundary)

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 SimpleCov Ruby Gem

Coverage Support Tools SimpleCov Ruby Gem

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

Summary The testing problem and terminology Unit, integration, and system testing Black-box testing and boundary conditions White-box testing and code coverage Control flow graphs Statement, condition, and path coverage http://flic.kr/p/aCLor3