Dynamic Testing Techniques

Slides:



Advertisements
Similar presentations
2017/3/25 Test Case Upgrade from “Test Case-Training Material v1.4.ppt” of Testing basics Authors: NganVK Version: 1.4 Last Update: Dec-2005.
Advertisements

Lecture 2: testing Book: Chapter 9 What is testing? Testing is not showing that there are no errors in the program. Testing cannot show that the program.
Software Testing Techniques
Software Testing Technique. Introduction Software Testing is the process of executing a program or system with the intent of finding errors. It involves.
Test Design Overview.
Defect testing Objectives
Test process essentials Riitta Viitamäki,
DETAILED DESIGN, IMPLEMENTATIONA AND TESTING Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
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.
Black Box Testing Csci 565 Spring 2009.
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
1 Software Engineering Lecture 11 Software Testing.
CMSC 345, Version 11/07 SD Vick from S. Mitchell Software Testing.
IMSE Week 18 White Box or Structural Testing Reading:Sommerville (4th edition) ch 22 orPressman (4th edition) ch 16.
Testing an individual module
1 Software Testing and Quality Assurance Lecture 5 - Software Testing Techniques.
1 Software Testing Techniques CIS 375 Bruce R. Maxim UM-Dearborn.
Equivalence Class Testing
1 Functional Testing Motivation Example Basic Methods Timing: 30 minutes.
Test Design Techniques
Testing techniques, example
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
System/Software Testing
Dynamic Black-Box Testing Part 2
Let us start from the V-Model Verification Phases Requirements analysis System Design Architecture Design Module Design Coding Validation phases Unit.
CS 217 Software Verification and Validation Week 6, Summer 2014 Instructor: Dong Si
Class Specification Implementation Graph By: Njume Njinimbam Chi-Chang Sun.
Introduction Telerik Software Academy Software Quality Assurance.
CMSC 345 Fall 2000 Unit Testing. The testing process.
CS4311 Spring 2011 Unit Testing Dr. Guoqiang Hu Department of Computer Science UTEP.
Software Testing Testing types Testing strategy Testing principles.
Agenda Introduction Overview of White-box testing Basis path testing
CSE403 Software Engineering Autumn 2001 More Testing Gary Kimura Lecture #10 October 22, 2001.
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.
Black Box Testing Techniques Chapter 7. Black Box Testing Techniques Prepared by: Kris C. Calpotura, CoE, MSME, MIT  Introduction Introduction  Equivalence.
Unit Testing 101 Black Box v. White Box. Definition of V&V Verification - is the product correct Validation - is it the correct product.
CS 217 Software Verification and Validation Week 7, Summer 2014 Instructor: Dong Si
Software Testing Input Space Partition Testing. 2 Input Space Coverage Four Structures for Modeling Software Graphs Logic Input Space Syntax Use cases.
1 Program Testing (Lecture 14) Prof. R. Mall Dept. of CSE, IIT, Kharagpur.
Software Engineering1  Verification: The software should conform to its specification  Validation: The software should do what the user really requires.
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.
Dynamic Testing.
Software Testing Reference: Software Engineering, Ian Sommerville, 6 th edition, Chapter 20.
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.
Verification vs. Validation Verification: "Are we building the product right?" The software should conform to its specification.The software should conform.
1 Software Testing. 2 What is Software Testing ? Testing is a verification and validation activity that is performed by executing program code.
Testing Integral part of the software development process.
Dynamic Black-Box Testing Part 1 What is dynamic black-box testing? How to reduce the number of test cases using: Equivalence partitioning Boundary value.
Software Testing. Software Quality Assurance Overarching term Time consuming (40% to 90% of dev effort) Includes –Verification: Building the product right,
Testing Tutorial 7.
Software Testing.
Rekayasa Perangkat Lunak Part-13
Software Testing.
Black Box Testing PPT Sources: Code Complete, 2nd Ed., Steve McConnell
Software Engineering (CSI 321)
CS5123 Software Validation and Quality Assurance
Chapter 13 & 14 Software Testing Strategies and Techniques
Types of Testing Visit to more Learning Resources.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Software Testing (Lecture 11-a)
Lecture 09:Software Testing
Static Testing Static testing refers to testing that takes place without Execution - examining and reviewing it. Dynamic Testing Dynamic testing is what.
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Testing techniques and methods
CSE403 Software Engineering Autumn 2000 More Testing
Test Design Techniques Software Testing: IN3240 / IN4240
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Chapter 13 & 14 Software Testing Strategies and Techniques 1 Software Engineering: A Practitioner’s Approach, 6th edition by Roger S. Pressman.
Presentation transcript:

Dynamic Testing Techniques Chapter 4 Software Testing ISTQB / ISEB Foundation Exam Practice 1 Principles 2 Lifecycle 3 Static testing 4 Dynamic test techniques 5 Management 6 Tools Dynamic Testing Techniques

Contents What is a testing technique? Black and White box testing 1 2 3 ISTQB / ISEB Foundation Exam Practice 4 5 6 Dynamic Testing Techniques Contents What is a testing technique? Black and White box testing Black box test techniques White box test techniques Error Guessing

Why dynamic test techniques? Exhaustive testing (use of all possible inputs and conditions) is impractical must use a subset of all possible test cases must have high probability of detecting faults Need thought processes that help us select test cases more intelligently test case design techniques are such thought processes

What is a testing technique? a procedure for selecting or designing tests based on a structural or functional model of the software successful at finding faults 'best' practice a way of deriving good test cases a way of objectively measuring a test effort Testing should be rigorous, thorough and systematic

Advantages of techniques Different people: similar probability find faults gain some independence of thought Effective testing: find more faults focus attention on specific types of fault know you're testing the right thing Efficient testing: find faults with less effort avoid duplication systematic techniques are measurable Using techniques makes testing much more effective

Measurement Objective assessment of thoroughness of testing (with respect to use of each technique) useful for comparison of one test effort to another E.g. Project A 60% Equivalence partitions 50% Boundaries 75% Branches Project B 40% Equivalence partitions 45% Boundaries 60% Branches

Contents What is a testing technique? Black and White box testing 1 2 3 ISTQB / ISEB Foundation Exam Practice 4 5 6 Dynamic Testing Techniques Contents What is a testing technique? Black and White box testing Black box test techniques White box test techniques Error Guessing

Three types of systematic technique Static (non-execution) examination of documentation, source code listings, etc. Functional (Black Box) based on behaviour / functionality of software Structural (White Box) based on structure of software

Some test techniques Dynamic Static Behavioural Structural etc. Reviews Behavioural Static Analysis Inspection Walkthroughs Structural Non-functional Functional etc. Desk-checking etc. Equivalence Partitioning Usability Control Flow Data Flow Performance Boundary Value Analysis etc. etc. Statement Symbolic Execution Cause-Effect Graphing Arcs Branch/Decision Random Branch Condition LCSAJ Definition -Use Branch Condition Combination State Transition

Black box versus white box? Integration Component Acceptance System Black box appropriate at all levels but dominates higher levels of testing White box used predominately at lower levels to compliment black box

Contents What is a testing technique? Black and White box testing 1 2 3 ISTQB / ISEB Foundation Exam Practice 4 5 6 Dynamic Testing Techniques Contents What is a testing technique? Black and White box testing Black box test techniques White box test techniques Error Guessing

Black Box test design and measurement techniques Techniques defined in BS 7925-2 Equivalence partitioning Boundary value analysis State transition testing Cause-effect graphing Syntax testing Random testing Also defines how to specify other techniques = Yes = No Also a measurement technique?

Equivalence partitioning (EP) divide (partition) the inputs, outputs, etc. into areas which are the same (equivalent) assumption: if one value works, all will work one from each partition better than all from one invalid valid 1 100 101

Boundary value analysis (BVA) faults tend to lurk near boundaries good place to look for faults test values on both sides of boundaries invalid valid 1 100 101

Example: Loan application 2-64 chars. Customer Name Account number Loan amount requested Term of loan Monthly repayment Term: Repayment: Interest rate: Total paid back: 6 digits, 1st non-zero £500 to £9000 1 to 30 years Minimum £10

Customer name Number of characters: 2 64 65 invalid valid 1 Valid characters: Any other A-Z a-z -’ space

Account number first character: invalid: zero valid: non-zero 5 6 7 number of digits:

Loan amount 500 9000 9001 invalid valid 499

Condition template

Design test cases Test Description Expected Outcome New Tags Case Covered 1 Name: John Smith Acc no: 123456 Loan: 2500 Term: 3 years Term: 3 years Repayment: 79.86 Interest rate: 10% Total paid: 2874.96 V1, V2, V3, V4, V5 ..... Name: AB Acc no: 100000 Loan: 500 Term: 1 year Term: 1 year Repayment: 44.80 Interest rate: 7.5% Total paid: 537.60 B1, B3, B5, ..... 2

Why do both EP and BVA? If you do boundaries only, you have covered all the partitions as well technically correct and may be OK if everything works correctly! if the test fails, is the whole partition wrong, or is a boundary in the wrong place - have to test mid-partition anyway testing only extremes may not give confidence for typical use scenarios (especially for users) boundaries may be harder (more costly) to set up

Test objectives? For a thorough approach: VP, IP, VB, IB Under time pressure, depends on your test objective minimal user-confidence: VP only? maximum fault finding: VB first (plus IB?)

Decision tables explore combinations of inputs, situations or events, it is very easy to overlook specific combinations of input start by expressing the input conditions of interest so that they are either TRUE or FALSE record found file exists code valid policy expired account in credit due date > current date

Example: student access A university computer system allows students an allocation of disc space depending on their projects. If they have used all their allotted space, they are only allowed restricted access, i.e. to delete files, not to create them. This is assuming they have logged on with a valid username and password. What are the input and output conditions?

List the input and output conditions list the ‘input conditions’ in the first column of the table list the ‘output conditions’ under the input conditions

Determine input combinations add columns to the table for each unique combination of input conditions. each entry in the table may be either ‘T’ for true, ‘F’ for false.

Rationalise input combinations some combinations may be impossible or not of interest some combinations may be ‘equivalent’ use a hyphen to denote “don’t care”

Complete the table determine the expected output conditions for each combination of input conditions

Determine test case groups each column is at least one test case

Design test cases usually one test case for each column but can be none or several

Rationalising outputs if outputs or effects are mutually exclusive, I.e. T occurs in only one place in each column, we can combine them for example: X T F F Y F T F Z F F T is equivalent to: Output X Y Z

Rationalising dangers rationalising is based on assumptions assumptions may be wrong! assumptions should be stated assumptions may change over time be aware of the dangers filling in the full table may find errors which will be missed if you rationalise it is possible to rationalise too far

Extending decision tables Entries can be more than just ‘true’ or ‘false’ completing table needs to be done carefully rationalising becomes more important E.g.

Decision Tables in relation to EP and BVA Input value Output value FALSE TRUE

State Transition Testing Not covered in this course. Info available as supplement

Contents What is a testing technique? Black and White box testing 1 2 3 ISTQB / ISEB Foundation Exam Practice 4 5 6 Dynamic Testing Techniques Contents What is a testing technique? Black and White box testing Black box test techniques White box test techniques Error Guessing

White Box test design and measurement techniques Techniques defined in BS 7925-2 Statement testing Branch / Decision testing Data flow testing Branch condition testing Branch condition combination testing Modified condition decision testing LCSAJ testing Also defines how to specify other techniques = Yes = No Also a measurement technique?

Using structural coverage Results OK? Enough tests? Spec Software Tests Coverage OK? What's covered? More tests More tests More tests More tests More tests More tests More tests More tests Stronger structural techniques (different structural elements) Increasing coverage

The test coverage trap better testing Function exercised, insufficient structure Functional testedness Structure exercised, insufficient function % Statement % Decision % Condition Combination Structural testedness 100% coverage does not mean 100% tested! Coverage is not Thoroughness

Typical ad hoc testing achieves 60 - 75% Statement coverage is normally measured by a software tool. Statement coverage percentage of executable statements exercised by a test suite number of statements exercised total number of statements example: program has 100 statements tests exercise 87 statements statement coverage = 87% ? = Typical ad hoc testing achieves 60 - 75%

Example of statement coverage Test case Input Expected output 1 2 3 4 5 Statement numbers read(a) IF a > 6 THEN b = a ENDIF print b 1 7 As all 5 statements are ‘covered’ by this test case, we have achieved 100% statement coverage

Decision coverage (Branch coverage) is normally measured by a software tool. Decision coverage (Branch coverage) percentage of decision outcomes exercised by a test suite number of decisions outcomes exercised total number of decision outcomes example: program has 120 decision outcomes tests exercise 60 decision outcomes decision coverage = 50% False ? = True Typical ad hoc testing achieves 40 - 60%

Paths through code 1 2 3 4 ? 1 2 1 2 1 2 3 ? ? ?

Paths through code with loops ? 1 2 3 4 5 6 7 8 …. for as many times as it is possible to go round the loop (this can be unlimited, i.e. infinite)

Example 1 Wait Wait for card to be inserted Valid card? Wait for card to be inserted IF card is a valid card THEN display “Enter PIN number” IF PIN is valid THEN Wait for card to be inserted IF card is a valid card THEN display “Enter PIN number” Wait for card to be inserted IF card is a valid card THEN display “Enter PIN number” IF PIN is valid THEN select transaction Wait for card to be inserted IF card is a valid card THEN display “Enter PIN number” IF PIN is valid THEN select transaction ELSE (otherwise) display “PIN invalid” reject card Wait for card to be inserted IF card is a valid card THEN Wait for card to be inserted IF card is a valid card THEN display “Enter PIN number” IF PIN is valid THEN select transaction ELSE (otherwise) display “PIN invalid” Wait for card to be inserted Wait for card to be inserted IF card is a valid card THEN display “Enter PIN number” IF PIN is valid THEN select transaction ELSE (otherwise) display “PIN invalid” reject card End Display “Enter.. Yes No Reject card Valid PIN? Select trans... Yes End Display “PIN in.. No

Example 2 3 Cyclomatic complexity: _____ Minimum tests to achieve: 1 3 Read Read A IF A > 0 THEN IF A = 21 THEN Print “Key” ENDIF Read A Print “Key” IF A > 0 THEN ENDIF IF A = 21 THEN ENDIF End A>0 No A=21 Yes No Print Yes 3 Cyclomatic complexity: _____ Minimum tests to achieve: Statement coverage: ______ Branch coverage: _____ 1 3

Example 3 4 Cyclomatic complexity: _____ Minimum tests to achieve: 2 4 Read A>0 End No Read A Read B IF A > 0 THEN IF B = 0 THEN Print “No values” ELSE Print B IF A > 21 THEN Print A ENDIF B=0 Print Yes Print A>21 No Print Yes 4 Cyclomatic complexity: _____ Minimum tests to achieve: Statement coverage: ______ Branch coverage: _____ 2 4

Example 4 Note: there are 4 paths 3 Cyclomatic complexity: _____ Print Yes A<0 Read Example 4 Print No Note: there are 4 paths Read A Read B IF A < 0 THEN Print “A negative” ELSE Print “A positive” ENDIF IF B < 0 THEN Print “B negative” Print “B positive” Print Yes B<0 Print No End 3 Cyclomatic complexity: _____ Minimum tests to achieve: Statement coverage: ______ Branch coverage: _____ 2 2

Example 5 3 Cyclomatic complexity: _____ Minimum tests to achieve: 1 2 Print Yes Read Example 5 No Read A Read B IF A < 0 THEN Print “A negative” ENDIF IF B < 0 THEN Print “B negative” B<0 Print Yes End No 3 Cyclomatic complexity: _____ Minimum tests to achieve: Statement coverage: ______ Branch coverage: _____ 1 2

Example 6 3 Cyclomatic complexity: _____ Minimum tests to achieve: 2 2 Print Yes Read Example 6 No Read A IF A < 0 THEN Print “A negative” ENDIF IF A > 0 THEN Print “A positive” A>0 Print Yes End No 3 Cyclomatic complexity: _____ Minimum tests to achieve: Statement coverage: ______ Branch coverage: _____ 2 2

Contents What is a testing technique? Black and White box testing 1 2 3 ISTQB / ISEB Foundation Exam Practice 4 5 6 Dynamic Testing Techniques Contents What is a testing technique? Black and White box testing Black box test techniques White box test techniques Error Guessing

Non-systematic test techniques Trial and error / Ad hoc Error guessing / Experience-driven User Testing Unscripted Testing A testing approach that is only rigorous, thorough and systematic is incomplete

Not a good approach to start testing with Error-Guessing always worth including after systematic techniques have been used can find some faults that systematic techniques can miss a ‘mopping up’ approach supplements systematic techniques Not a good approach to start testing with

Error Guessing: deriving test cases Consider: past failures intuition experience brain storming “What is the craziest thing we can do?”

1 2 3 ISTQB / ISEB Foundation Exam Practice 4 5 6 Dynamic Testing Techniques Summary: Key Points Test techniques are ‘best practice’: help to find faults Black Box techniques are based on behaviour White Box techniques are based on structure Error Guessing supplements systematic techniques