SlideShare une entreprise Scribd logo
1  sur  13
Software Testing Techniques Instructor: Dr. Jerry Gao
Software Testing Techniques Jerry Gao, Ph.D. Jan.  1999 - Software Testing Fundamentals - Testing Objectives, Principles, Testability - Software Test Case Design - White-Box Testing - Cyclomatic Complexity - Graph Matrices - Control Structuring Testing (not included) - Condition Testing (not included) - Data Flow Testing (not included) - Loop Testing (not included) - Black-Box Testing - Graph-based Testing Methods (not included) - Equivalence Partitioning - Boundary Value Analysis - Comparison Testing (not included)
Software Testing Fundamentals Software testing is a critical element of software quality assurance and represents the ultimate review of specification, design, and coding. Software testing demonstrates that software function appear to be working according to specifications and performance requirements. Testing Objectives: Myers [MYE79] states a number of rules that can serve well as testing objectives: - Testing is a process of executing a program with the intent of finding an error. - A good test case is one that has high probability of finding an undiscovered error. - A successful test is one that uncovers an as-yet undiscovered error. The  major testing objective  is to design tests that systematically uncover types of errors with minimum time and effort.
Software Testing Principles Davids [DAV95] suggests a set of testing principles: - All tests should be traceable to customer requirements. - Tests should be planned long before testing begins. - The Pareto principle applies to software testing. - 80% of all errors uncovered during testing will likely be traceable to 20% of all program modules. - Testing should begin “in the small” and progress toward testing “in the large”. - Exhaustive testing is not possible. - To be most effective, testing should be conducted by an independent third party.
Software Testability According to James Bach: Software testability  is simply how easily a computer program can be tested. A set of program characteristics that lead to testable software: - Operability: “the better it works, the more efficiently it can be tested.” - Observability: “What you see is what you test.” - Controllability: “The better we can control the software, the more the testing can be automated and optimized.” - Decomposability: “By controlling the scope of testing, we can more quickly isolate problems and perform smarter retesting.” - Simplicity: “The less there is to test, the more quickly we can test it.” - Stability: “The fewer the changes, the fewer the disruptions to testing.” - Understandability:”The more information we have, the smarter we will test.”
Test Case Design Two general software testing approaches: Black-Box Testing and White-Box Testing Black-box testing: knowing the specific functions of a software, design tests to demonstrate each function and check its errors. Major focus:  functions, operations, external interfaces, external data and information White-box testing: knowing the internals of a software,  design tests to exercise all internals of a software to make sure  they operates according to specifications and designs Major focus: internal structures, logic paths, control flows, data flows   internal data structures, conditions, loops, etc.
White-Box Testing and Basis Path Testing White-box testing, also known as glass-box testing. It is a test case design method that uses the control structure of the procedural design to derive test cases. Using white-box testing methods, we derive test cases that - Guarantee that all independent paths within a module have been exercised at  least once. - Exercise all logical decisions one their true and false sides. - Execute all loops at their boundaries and within their operational bounds. - Exercise internal data structures to assure their validity. Basic path testing (a white-box testing technique):   - First proposed by TomMcCabe [MCC76]. - Can be used to derive a logical complexity measure for a procedure design. - Used as a guide for defining a basis set of execution path. - Guarantee to execute every statement in the program at least one time.
Cyclomatic Complexity Cyclomatic complexity is a software metric -> provides a quantitative measure of the global complexity of a program. When this metric is used in the context of the basis path testing, the value computed for cyclomatic complexity defines the number of independent paths in the basis set of a program. Three ways to compute cyclomatic complexity: - The number of regions of the flow graph correspond to the cyclomatic complexity. - Cyclomatic complexity, V(G), for a flow graph G is defined as V(G) = E - N +2 where E is the number of flow graph edges and N is the number of flow graph nodes. - Cyclomatic complexity, V(G) = P + 1 where P is the number of predicate nodes contained in the flow graph G.
Deriving Test Cases Step 1 :  Using the design or code as a foundation, draw a corresponding flow  graph. Step 2:  Determine the cyclomatic complexity of the resultant flow graph. Step 3:  Determine a basis set of linearly independent paths. For example,  path 1: 1-2-10-11-13 path 2: 1-2-10-12-13 path 3: 1-2-3-10-11-13 path 4: 1-2-3-4-5-8-9-2-… path 5: 1-2-3-4-5-6-8-9-2-.. Path 6: 1-2-3-4-5-6-7-8-9-2-.. Step 4: Prepare test cases that will force execution of each path in the basis  set. Path 1: test case: value (k) = valid input, where k < i defined below. value (i) = -999, where 2 <= I <= 100 expected results: correct average based on k values and proper totals.
Equivalence Partitioning Equivalence partitioning  is a black-box testing method - divide the input domain of a program into classes of data - derive test cases based on these partitions. Test case design for equivalence partitioning is based on an evaluation of equivalence classes for an input domain. An  equivalence class  represents a set of valid or invalid states for input condition.  An  input condition  is: - a specific numeric value, a range of values - a set of related values, or a Boolean condition system Valid inputs invalid inputs outputs partition
Equivalence Classes Equivalence classes can be defined using the following guidelines: - If an input condition specifies a range, one valid and two invalid equivalence  class are defined. - If an input condition requires a specific value, one valid and two invalid  equivalence classes are defined. - If an input condition specifies a member of a set, one valid and one invalid  equivalence classes are defined. - If an input condition is Boolean, one valid and one invalid classes are  defined. Examples: area code: input condition, Boolean - the area code may or may not be present. input condition, range  - value defined between 200 and 900 password: input condition, Boolean - a password nay or may not be present. input condition, value - six character string. command: input condition, set - containing commands noted before.
Boundary Value Analysis Boundary value analysis(BVA )  - a test case design technique - complements to equivalence partition Objective: Boundary value analysis leads to a selection of test cases that exercise bounding values. Guidelines: - If an input condition specifies a range bounded by values a and b, test cases should be designed with value a and b, just above and below a and b. Example: Integer D with input condition [-3, 10],  test values: -3, 10, 11, -2, 0 - If an input condition specifies a number values, test cases should be developed to exercise the minimum and maximum numbers. Values just above and below minimum and maximum are also tested. Example: Enumerate data E with input condition: {3, 5, 100, 102} test values: 3, 102, -1, 200, 5
Boundary Value Analysis - Guidelines 1 and 2 are applied to output condition. - If internal program data structures have prescribed boundaries, be certain to design a test case to exercise the data structure at its boundary Such as data structures: - array input condition: empty, single element, full element, out-of-boundary search for element: - element is inside array or the element is not inside array You can think about other data structures: - list, set, stack, queue, and tree

Contenu connexe

Tendances

New software testing-techniques
New software testing-techniquesNew software testing-techniques
New software testing-techniques
Fincy V.J
 
Glossary of Testing Terms and Concepts
Glossary of Testing Terms and ConceptsGlossary of Testing Terms and Concepts
Glossary of Testing Terms and Concepts
mqamarhayat
 
Integration in component based technology
Integration in component based technologyIntegration in component based technology
Integration in component based technology
Saransh Garg
 

Tendances (20)

Software testing
Software testingSoftware testing
Software testing
 
Black Box Testing
Black Box TestingBlack Box Testing
Black Box Testing
 
Dynamic analysis in Software Testing
Dynamic analysis in Software TestingDynamic analysis in Software Testing
Dynamic analysis in Software Testing
 
7 stages of unit testing
7 stages of unit testing7 stages of unit testing
7 stages of unit testing
 
New software testing-techniques
New software testing-techniquesNew software testing-techniques
New software testing-techniques
 
Glossary of Testing Terms and Concepts
Glossary of Testing Terms and ConceptsGlossary of Testing Terms and Concepts
Glossary of Testing Terms and Concepts
 
Testing
TestingTesting
Testing
 
Quality assurance tests
Quality assurance testsQuality assurance tests
Quality assurance tests
 
Software Testing Techniques
Software Testing TechniquesSoftware Testing Techniques
Software Testing Techniques
 
Ppt19
Ppt19Ppt19
Ppt19
 
Testing strategies
Testing strategiesTesting strategies
Testing strategies
 
Object oriented testing
Object oriented testingObject oriented testing
Object oriented testing
 
Se (techniques for black box testing ppt)
Se (techniques for black box testing ppt)Se (techniques for black box testing ppt)
Se (techniques for black box testing ppt)
 
Software Testing Techniques: An Overview
Software Testing Techniques: An Overview Software Testing Techniques: An Overview
Software Testing Techniques: An Overview
 
Testing of Object-Oriented Software
Testing of Object-Oriented SoftwareTesting of Object-Oriented Software
Testing of Object-Oriented Software
 
Integration in component based technology
Integration in component based technologyIntegration in component based technology
Integration in component based technology
 
Test case design
Test case designTest case design
Test case design
 
Black Box Testing
Black Box TestingBlack Box Testing
Black Box Testing
 
Object Oriented Testing(OOT) presentation slides
Object Oriented Testing(OOT) presentation slidesObject Oriented Testing(OOT) presentation slides
Object Oriented Testing(OOT) presentation slides
 
Software Testing Techniques
Software Testing TechniquesSoftware Testing Techniques
Software Testing Techniques
 

En vedette

3 mazzetto, la stazione ferroviaria, da contenitore multifunzionale ...
3   mazzetto, la stazione ferroviaria, da contenitore multifunzionale ...3   mazzetto, la stazione ferroviaria, da contenitore multifunzionale ...
3 mazzetto, la stazione ferroviaria, da contenitore multifunzionale ...
Biennale spazio pubblico
 
Advertise to College Students
Advertise to College StudentsAdvertise to College Students
Advertise to College Students
Pranav Babbar
 
4 bannerman, i parcheggi per la razionalizzazione della mobilità e ...
4   bannerman, i parcheggi per la razionalizzazione della mobilità e ...4   bannerman, i parcheggi per la razionalizzazione della mobilità e ...
4 bannerman, i parcheggi per la razionalizzazione della mobilità e ...
Biennale spazio pubblico
 

En vedette (18)

Linux
LinuxLinux
Linux
 
3 mazzetto, la stazione ferroviaria, da contenitore multifunzionale ...
3   mazzetto, la stazione ferroviaria, da contenitore multifunzionale ...3   mazzetto, la stazione ferroviaria, da contenitore multifunzionale ...
3 mazzetto, la stazione ferroviaria, da contenitore multifunzionale ...
 
Slide capena
Slide capenaSlide capena
Slide capena
 
Sociedad de la información
Sociedad de la informaciónSociedad de la información
Sociedad de la información
 
θεατρική αγωγή
θεατρική αγωγήθεατρική αγωγή
θεατρική αγωγή
 
Slide rovigo percorso habitat
Slide rovigo percorso habitatSlide rovigo percorso habitat
Slide rovigo percorso habitat
 
Advertise to College Students
Advertise to College StudentsAdvertise to College Students
Advertise to College Students
 
STOP BULLING
STOP BULLINGSTOP BULLING
STOP BULLING
 
Introdução ao php - Tipos de variáveis
Introdução ao php - Tipos de variáveisIntrodução ao php - Tipos de variáveis
Introdução ao php - Tipos de variáveis
 
Car aerodynamic devices
Car aerodynamic devices Car aerodynamic devices
Car aerodynamic devices
 
STOP BULLING
STOP BULLINGSTOP BULLING
STOP BULLING
 
4 bannerman, i parcheggi per la razionalizzazione della mobilità e ...
4   bannerman, i parcheggi per la razionalizzazione della mobilità e ...4   bannerman, i parcheggi per la razionalizzazione della mobilità e ...
4 bannerman, i parcheggi per la razionalizzazione della mobilità e ...
 
Poetry in Exams - 1st Class - 3rd year
Poetry in Exams - 1st Class - 3rd yearPoetry in Exams - 1st Class - 3rd year
Poetry in Exams - 1st Class - 3rd year
 
Teaching Testing Qw%202001
Teaching Testing Qw%202001Teaching Testing Qw%202001
Teaching Testing Qw%202001
 
Testing writing (for Language Teachers)
Testing writing (for Language Teachers)Testing writing (for Language Teachers)
Testing writing (for Language Teachers)
 
82543946 ssg-accomplishment-report
82543946 ssg-accomplishment-report82543946 ssg-accomplishment-report
82543946 ssg-accomplishment-report
 
Needs Analysis and Evaluation In English Specific Purposes
Needs Analysis and Evaluation In English Specific PurposesNeeds Analysis and Evaluation In English Specific Purposes
Needs Analysis and Evaluation In English Specific Purposes
 
Presentation1
Presentation1Presentation1
Presentation1
 

Similaire à Test Techniques

software testing types jxnvlbnLCBNFVjnl/fknblb
software testing types jxnvlbnLCBNFVjnl/fknblbsoftware testing types jxnvlbnLCBNFVjnl/fknblb
software testing types jxnvlbnLCBNFVjnl/fknblb
jeyasrig
 
1414_lecturueueueueuueueeueueueuusuee_7.ppt
1414_lecturueueueueuueueeueueueuusuee_7.ppt1414_lecturueueueueuueueeueueueuusuee_7.ppt
1414_lecturueueueueuueueeueueueuusuee_7.ppt
abdulbasetalselwi
 
Qat09 presentations dxw07u
Qat09 presentations dxw07uQat09 presentations dxw07u
Qat09 presentations dxw07u
Shubham Sharma
 

Similaire à Test Techniques (20)

CS8494 SOFTWARE ENGINEERING Unit-4
CS8494 SOFTWARE ENGINEERING Unit-4CS8494 SOFTWARE ENGINEERING Unit-4
CS8494 SOFTWARE ENGINEERING Unit-4
 
Testing
TestingTesting
Testing
 
Testing
TestingTesting
Testing
 
Test Levels & Techniques
Test Levels & TechniquesTest Levels & Techniques
Test Levels & Techniques
 
Chapter 8 Testing Tactics.ppt Software engineering
Chapter 8 Testing Tactics.ppt Software engineeringChapter 8 Testing Tactics.ppt Software engineering
Chapter 8 Testing Tactics.ppt Software engineering
 
Chapter 8 Testing Tactics.ppt
Chapter 8 Testing Tactics.pptChapter 8 Testing Tactics.ppt
Chapter 8 Testing Tactics.ppt
 
Software Engineering (Testing techniques)
Software Engineering (Testing techniques)Software Engineering (Testing techniques)
Software Engineering (Testing techniques)
 
Software Engineering (Testing techniques)
Software Engineering (Testing techniques)Software Engineering (Testing techniques)
Software Engineering (Testing techniques)
 
software testing types jxnvlbnLCBNFVjnl/fknblb
software testing types jxnvlbnLCBNFVjnl/fknblbsoftware testing types jxnvlbnLCBNFVjnl/fknblb
software testing types jxnvlbnLCBNFVjnl/fknblb
 
Class9_SW_Testing_Strategies.pdf
Class9_SW_Testing_Strategies.pdfClass9_SW_Testing_Strategies.pdf
Class9_SW_Testing_Strategies.pdf
 
11 whiteboxtesting
11 whiteboxtesting11 whiteboxtesting
11 whiteboxtesting
 
1414_lecturueueueueuueueeueueueuusuee_7.ppt
1414_lecturueueueueuueueeueueueuusuee_7.ppt1414_lecturueueueueuueueeueueueuusuee_7.ppt
1414_lecturueueueueuueueeueueueuusuee_7.ppt
 
Test Case Design and Technique
Test Case Design and TechniqueTest Case Design and Technique
Test Case Design and Technique
 
Test Case Design
Test Case DesignTest Case Design
Test Case Design
 
Test Case Design and Technique
Test Case Design and TechniqueTest Case Design and Technique
Test Case Design and Technique
 
Test Case Design and Technique
Test Case Design and TechniqueTest Case Design and Technique
Test Case Design and Technique
 
Test Case Design & Technique
Test Case Design & TechniqueTest Case Design & Technique
Test Case Design & Technique
 
Qat09 presentations dxw07u
Qat09 presentations dxw07uQat09 presentations dxw07u
Qat09 presentations dxw07u
 
Software engineering Testing technique,test case,test suit design
Software engineering Testing technique,test case,test suit designSoftware engineering Testing technique,test case,test suit design
Software engineering Testing technique,test case,test suit design
 
Blackbox
BlackboxBlackbox
Blackbox
 

Plus de nazeer pasha (20)

Tomcat Configuration (1)
Tomcat Configuration (1)Tomcat Configuration (1)
Tomcat Configuration (1)
 
Testing Types Presentation
Testing Types PresentationTesting Types Presentation
Testing Types Presentation
 
Good Ppt On Risk
Good Ppt On RiskGood Ppt On Risk
Good Ppt On Risk
 
Bug Advocacy
Bug AdvocacyBug Advocacy
Bug Advocacy
 
Doe Taguchi Basic Manual1
Doe Taguchi Basic Manual1Doe Taguchi Basic Manual1
Doe Taguchi Basic Manual1
 
Orth Arrays
Orth ArraysOrth Arrays
Orth Arrays
 
Tc Checklist
Tc ChecklistTc Checklist
Tc Checklist
 
Software Testing Guide
Software Testing GuideSoftware Testing Guide
Software Testing Guide
 
Cstp Certification Compare
Cstp Certification CompareCstp Certification Compare
Cstp Certification Compare
 
Blackboxtesting 02 An Example Test Series
Blackboxtesting 02 An Example Test SeriesBlackboxtesting 02 An Example Test Series
Blackboxtesting 02 An Example Test Series
 
Exploratory Testing
Exploratory TestingExploratory Testing
Exploratory Testing
 
Chanakya Niti
Chanakya NitiChanakya Niti
Chanakya Niti
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 
Testing
TestingTesting
Testing
 
Testing Types And Models
Testing Types And ModelsTesting Types And Models
Testing Types And Models
 
Swtesting
SwtestingSwtesting
Swtesting
 
Testing Framework
Testing FrameworkTesting Framework
Testing Framework
 
Testing
TestingTesting
Testing
 
Swe3643 2006 Decision Table Based Testing
Swe3643 2006 Decision Table Based TestingSwe3643 2006 Decision Table Based Testing
Swe3643 2006 Decision Table Based Testing
 
Softwaretesting
SoftwaretestingSoftwaretesting
Softwaretesting
 

Dernier

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Test Techniques

  • 1. Software Testing Techniques Instructor: Dr. Jerry Gao
  • 2. Software Testing Techniques Jerry Gao, Ph.D. Jan. 1999 - Software Testing Fundamentals - Testing Objectives, Principles, Testability - Software Test Case Design - White-Box Testing - Cyclomatic Complexity - Graph Matrices - Control Structuring Testing (not included) - Condition Testing (not included) - Data Flow Testing (not included) - Loop Testing (not included) - Black-Box Testing - Graph-based Testing Methods (not included) - Equivalence Partitioning - Boundary Value Analysis - Comparison Testing (not included)
  • 3. Software Testing Fundamentals Software testing is a critical element of software quality assurance and represents the ultimate review of specification, design, and coding. Software testing demonstrates that software function appear to be working according to specifications and performance requirements. Testing Objectives: Myers [MYE79] states a number of rules that can serve well as testing objectives: - Testing is a process of executing a program with the intent of finding an error. - A good test case is one that has high probability of finding an undiscovered error. - A successful test is one that uncovers an as-yet undiscovered error. The major testing objective is to design tests that systematically uncover types of errors with minimum time and effort.
  • 4. Software Testing Principles Davids [DAV95] suggests a set of testing principles: - All tests should be traceable to customer requirements. - Tests should be planned long before testing begins. - The Pareto principle applies to software testing. - 80% of all errors uncovered during testing will likely be traceable to 20% of all program modules. - Testing should begin “in the small” and progress toward testing “in the large”. - Exhaustive testing is not possible. - To be most effective, testing should be conducted by an independent third party.
  • 5. Software Testability According to James Bach: Software testability is simply how easily a computer program can be tested. A set of program characteristics that lead to testable software: - Operability: “the better it works, the more efficiently it can be tested.” - Observability: “What you see is what you test.” - Controllability: “The better we can control the software, the more the testing can be automated and optimized.” - Decomposability: “By controlling the scope of testing, we can more quickly isolate problems and perform smarter retesting.” - Simplicity: “The less there is to test, the more quickly we can test it.” - Stability: “The fewer the changes, the fewer the disruptions to testing.” - Understandability:”The more information we have, the smarter we will test.”
  • 6. Test Case Design Two general software testing approaches: Black-Box Testing and White-Box Testing Black-box testing: knowing the specific functions of a software, design tests to demonstrate each function and check its errors. Major focus: functions, operations, external interfaces, external data and information White-box testing: knowing the internals of a software, design tests to exercise all internals of a software to make sure they operates according to specifications and designs Major focus: internal structures, logic paths, control flows, data flows internal data structures, conditions, loops, etc.
  • 7. White-Box Testing and Basis Path Testing White-box testing, also known as glass-box testing. It is a test case design method that uses the control structure of the procedural design to derive test cases. Using white-box testing methods, we derive test cases that - Guarantee that all independent paths within a module have been exercised at least once. - Exercise all logical decisions one their true and false sides. - Execute all loops at their boundaries and within their operational bounds. - Exercise internal data structures to assure their validity. Basic path testing (a white-box testing technique): - First proposed by TomMcCabe [MCC76]. - Can be used to derive a logical complexity measure for a procedure design. - Used as a guide for defining a basis set of execution path. - Guarantee to execute every statement in the program at least one time.
  • 8. Cyclomatic Complexity Cyclomatic complexity is a software metric -> provides a quantitative measure of the global complexity of a program. When this metric is used in the context of the basis path testing, the value computed for cyclomatic complexity defines the number of independent paths in the basis set of a program. Three ways to compute cyclomatic complexity: - The number of regions of the flow graph correspond to the cyclomatic complexity. - Cyclomatic complexity, V(G), for a flow graph G is defined as V(G) = E - N +2 where E is the number of flow graph edges and N is the number of flow graph nodes. - Cyclomatic complexity, V(G) = P + 1 where P is the number of predicate nodes contained in the flow graph G.
  • 9. Deriving Test Cases Step 1 : Using the design or code as a foundation, draw a corresponding flow graph. Step 2: Determine the cyclomatic complexity of the resultant flow graph. Step 3: Determine a basis set of linearly independent paths. For example, path 1: 1-2-10-11-13 path 2: 1-2-10-12-13 path 3: 1-2-3-10-11-13 path 4: 1-2-3-4-5-8-9-2-… path 5: 1-2-3-4-5-6-8-9-2-.. Path 6: 1-2-3-4-5-6-7-8-9-2-.. Step 4: Prepare test cases that will force execution of each path in the basis set. Path 1: test case: value (k) = valid input, where k < i defined below. value (i) = -999, where 2 <= I <= 100 expected results: correct average based on k values and proper totals.
  • 10. Equivalence Partitioning Equivalence partitioning is a black-box testing method - divide the input domain of a program into classes of data - derive test cases based on these partitions. Test case design for equivalence partitioning is based on an evaluation of equivalence classes for an input domain. An equivalence class represents a set of valid or invalid states for input condition. An input condition is: - a specific numeric value, a range of values - a set of related values, or a Boolean condition system Valid inputs invalid inputs outputs partition
  • 11. Equivalence Classes Equivalence classes can be defined using the following guidelines: - If an input condition specifies a range, one valid and two invalid equivalence class are defined. - If an input condition requires a specific value, one valid and two invalid equivalence classes are defined. - If an input condition specifies a member of a set, one valid and one invalid equivalence classes are defined. - If an input condition is Boolean, one valid and one invalid classes are defined. Examples: area code: input condition, Boolean - the area code may or may not be present. input condition, range - value defined between 200 and 900 password: input condition, Boolean - a password nay or may not be present. input condition, value - six character string. command: input condition, set - containing commands noted before.
  • 12. Boundary Value Analysis Boundary value analysis(BVA ) - a test case design technique - complements to equivalence partition Objective: Boundary value analysis leads to a selection of test cases that exercise bounding values. Guidelines: - If an input condition specifies a range bounded by values a and b, test cases should be designed with value a and b, just above and below a and b. Example: Integer D with input condition [-3, 10], test values: -3, 10, 11, -2, 0 - If an input condition specifies a number values, test cases should be developed to exercise the minimum and maximum numbers. Values just above and below minimum and maximum are also tested. Example: Enumerate data E with input condition: {3, 5, 100, 102} test values: 3, 102, -1, 200, 5
  • 13. Boundary Value Analysis - Guidelines 1 and 2 are applied to output condition. - If internal program data structures have prescribed boundaries, be certain to design a test case to exercise the data structure at its boundary Such as data structures: - array input condition: empty, single element, full element, out-of-boundary search for element: - element is inside array or the element is not inside array You can think about other data structures: - list, set, stack, queue, and tree