SlideShare a Scribd company logo
Testing and Debugging
‘Good’ software is…
Robust
Portable
• Produces the correct output
• from the correct input
• Copes with invalid input data
• Deals with unexpected conditions
• Runs on different platforms such as
OSX/Windows/Linux
Reliable
Testing
Lesson Aims
By the end of this lesson all pupils will be able to:
❏ Describe the types of errors that may be discovered
❏ Explain what is meant by systematic testing
❏ Explain what is meant by comprehensive testing
❏ Explain the importance for documentation at every stage of the project
A philosophical view…
“Program testing can be a very
effective way to show the
presence of bugs, but it is
hopelessly inadequate for
showing their absence.”
Edsger W. Dijkstra 1972
The Humble
Programmer (1972)
Hamilton Richards
Testing
What is the purpose of testing any product?
❏ Is it Fit for purpose - does it meet the specification
❏ Is it robust
❏ Is it reliable
MURPHY’s LAW 1
The quicker program coding is
started the longer the project will
take
MURPHY’s LAW 2
Murphy’s Law 1 is correct!
Aspects of Testing
Testing has to follow a plan.
It has to be systematic
it has to be comprehensive
What are we testing?
What is the function we want to test
What data/actions do we need to perform to test this?
What is the expected (correct) output?
Aspects of Testing (cont.)
In an ideal world testing would be exhaustive – meaning that every single possible
condition would be tested
This is unfortunately not the case.
However your testing can be comprehensive
One way is to ensure that you use a wide range of test data
Modules can be tested individually
Modules can also be tested to ensure that they integrate well
Test Data
Type Description Accepted
Normal This is data that the program should be
expected to use in normal operation YES
Extreme This is data at the edge of what is
acceptable, such as high and low limits
or boundaries
YES
Exceptional This is invalid data. Robust programs
should reject this NO
A Testing table
Imagine a program that accepted and graded pass marks between 0 and 20, a pass is 12
or more.
You should show for each input what the expected output is and the actual output and
make a comment.
This may be as simple as ‘As Expected’
Testing Table
Type Input Expected
Output
Actual
Output
Comment
NORMAL 2 FAIL FAIL As Expected
7 FAIL FAIL As Expected
12 PASS PASS As Expected
EXTREME 0 FAIL FAIL As Expected
20 PASS PASS As Expected
EXCEPTIONAL -1 Error Error Program Crashes
21 Error Error Program Crashes
Phases of Testing
Alpha Testing
Internal testing
Pre-Release
Done by Development Team
Beta Testing
Testing a program in working conditions
Members of public or independent test group
Feedback provided to the development team
Types of Errors (recap)
When testing programs there will be errors (bugs) there are different types…
1. Syntax
These are mistakes in the programming ‘grammar’
e.g. Forgetting to put a semi colon or close a bracket
1. Execution
These are errors detected during run-time. Divide by zero etc.
1. Logic
These are errors in the design of the program
Passing the wrong data into a function
Programs will fail
translation so won't run
Programs will run but give
some unintended output
Programs will usually
fail during runtime
Constructing a test plan
The purpose of a test plan is to ensure that you are systematically and
comprehensively testing your system
The test plan must test the functionality of the software
❏ A successful test is one that finds errors!
❏ Try to find the errors!
Test cases and Data
What are your test cases?
This can be thought of as the ‘user’ interaction with your system
What test data will you use - your system may not be populated
What data will you use in your system to ensure that your tests are valid?
Debugging Techniques
Debugging tools
What if it finds an error?
There are various debugging techniques/tools
❏ Dry Runs
❏ Trace Tables/Tools
❏ Breakpoints
❏ Watchpoints
Dry Runs
A dry run is when you manually stepping through the lines of code without the need
for executing the program. Can be useful for logic errors.
Trace table
When you use a trace table you step through the code recording changes to variables.
The changes can then be used to track when and what it is being changed to.
Breakpoints
You set breakpoints to stop execution of the code at specified lines of code.
At this point the contents of variables can be examined
This can be a method to ascertain if a piece of code is actually being executed,
obviously useful for debugging conditional statements.
As you can check if the variables match the conditions you think they do
Allows execution to be halted and the contents of variables inspected
Breakpoints in Python (Pycharm)
Watchpoints
Watchpoints are similar to breakpoints but they are assigned to variables
They then stop the execution of the program only when the contents of a specific
variable(s) meet a particular condition.
This can be at any point in the execution of the code
Watchpoint set for when counter == 1
Will halt the execution of the program when the variable counter changes to 1

More Related Content

What's hot (19)

PPTX
Software Testing Fundamentals | Basics Of Software Testing
KostCare
 
PPTX
Software testing
balamurugan.k Kalibalamurugan
 
PPTX
Research issues in object oriented software testing
Anshul Vinayak
 
PPTX
unit testing and debugging
KarthigaGunasekaran1
 
PPT
Software Testing
Kiran Kumar
 
PPTX
Software testing.ppt
Komal Garg
 
PPTX
Testing in multiplatform environment
shivanichauhan1953
 
PPTX
Software Testing - Part 1 (Techniques, Types, Levels, Methods, STLC, Bug Life...
Ankit Prajapati
 
PPTX
Software Testing Technique in Software Engineering
Ismail Hussain
 
PPTX
SOFTWARE TESTING UNIT-4
Mohammad Faizan
 
PPTX
Object Oriented Testing(OOT) presentation slides
Punjab University
 
PPTX
Testing (System Analysis and Design)
Areeb Khan
 
PPTX
Software testing methods
Homa Pourmohammadi
 
PPTX
Software testing
Bhagyashree pathak
 
PPTX
Object oriented testing
Haris Jamil
 
PPTX
Software Testing Strategies
Alpana Bhaskar
 
PPTX
Software Testing Strategies
Adeel Rasheed
 
PPTX
Structural and functional testing
Himanshu
 
Software Testing Fundamentals | Basics Of Software Testing
KostCare
 
Research issues in object oriented software testing
Anshul Vinayak
 
unit testing and debugging
KarthigaGunasekaran1
 
Software Testing
Kiran Kumar
 
Software testing.ppt
Komal Garg
 
Testing in multiplatform environment
shivanichauhan1953
 
Software Testing - Part 1 (Techniques, Types, Levels, Methods, STLC, Bug Life...
Ankit Prajapati
 
Software Testing Technique in Software Engineering
Ismail Hussain
 
SOFTWARE TESTING UNIT-4
Mohammad Faizan
 
Object Oriented Testing(OOT) presentation slides
Punjab University
 
Testing (System Analysis and Design)
Areeb Khan
 
Software testing methods
Homa Pourmohammadi
 
Software testing
Bhagyashree pathak
 
Object oriented testing
Haris Jamil
 
Software Testing Strategies
Alpana Bhaskar
 
Software Testing Strategies
Adeel Rasheed
 
Structural and functional testing
Himanshu
 

Similar to H testing and debugging (20)

PPTX
Software Testing Introduction (Part 1)
Thapar Institute
 
PPTX
Software Testing
Forrester High School
 
PPTX
Understanding Key Concepts and Applications in Week 11: A Comprehensive Overv...
bahay78365
 
PPTX
Software Testing_A_mmmmmmmmmmmmmmmmmmmmm
IwannatelluAstorylas
 
PPT
Chapter 6,7 Software coding and Testing.ppt
gadisaAdamu
 
PPT
SD & D Testing
Forrester High School
 
PPT
National 5 Computing Science - Testing
Forrester High School
 
PPTX
Testing Plan
Ajeng Savitri
 
PPTX
Unit1
Abhimanyu Mishra
 
PPTX
Computational thinking
r123457
 
PPTX
SE - Lecture 8 - Software Testing State Diagram.pptx
TangZhiSiang
 
PPT
Software Engineering Lec 10 -software testing--
Taymoor Nazmy
 
PPT
Testing Software Solutions
gavhays
 
PPTX
Software quality assurance,eTesting.pptx
singbling
 
PPT
12 sdd lesson testing and evaluating
Mike Cusack
 
PDF
software-testing-yogesh-singh (1).pdf
JhaKaustubh1
 
PPTX
Software Testing
Vishal Singh
 
ODP
Black boxtesting
funtest06
 
PPT
Testing foundations
Neha Singh
 
PPT
lec-11 Testing.ppt
debjani12
 
Software Testing Introduction (Part 1)
Thapar Institute
 
Software Testing
Forrester High School
 
Understanding Key Concepts and Applications in Week 11: A Comprehensive Overv...
bahay78365
 
Software Testing_A_mmmmmmmmmmmmmmmmmmmmm
IwannatelluAstorylas
 
Chapter 6,7 Software coding and Testing.ppt
gadisaAdamu
 
SD & D Testing
Forrester High School
 
National 5 Computing Science - Testing
Forrester High School
 
Testing Plan
Ajeng Savitri
 
Computational thinking
r123457
 
SE - Lecture 8 - Software Testing State Diagram.pptx
TangZhiSiang
 
Software Engineering Lec 10 -software testing--
Taymoor Nazmy
 
Testing Software Solutions
gavhays
 
Software quality assurance,eTesting.pptx
singbling
 
12 sdd lesson testing and evaluating
Mike Cusack
 
software-testing-yogesh-singh (1).pdf
JhaKaustubh1
 
Software Testing
Vishal Singh
 
Black boxtesting
funtest06
 
Testing foundations
Neha Singh
 
lec-11 Testing.ppt
debjani12
 
Ad

More from missstevenson01 (20)

PPTX
S3 environment
missstevenson01
 
PPTX
The Processor.pptx
missstevenson01
 
PPTX
How Computers Work
missstevenson01
 
PPTX
Lesson 3 - Coding with Minecraft - Variables.pptx
missstevenson01
 
PPTX
Lesson 2 - Coding with Minecraft - Events.pptx
missstevenson01
 
PPTX
Lesson 1 - Coding with Minecraft -Introduction.pptx
missstevenson01
 
PPTX
Lesson2 - Coding with Minecraft - Events.pptx
missstevenson01
 
PPTX
Ethical hacking trojans, worms and spyware
missstevenson01
 
PPTX
Ethical hacking anti virus
missstevenson01
 
PPTX
Ethical hacking introduction to ethical hacking
missstevenson01
 
PPTX
S1 internet safety-chattingonline
missstevenson01
 
PPTX
S3 wireframe diagrams
missstevenson01
 
PPTX
Alien database
missstevenson01
 
PPTX
Video Games and Copyright laws
missstevenson01
 
PPTX
Games Design Document
missstevenson01
 
PPTX
Video game proposal
missstevenson01
 
PPTX
Evaluation
missstevenson01
 
PPTX
H evaluation
missstevenson01
 
PPTX
H file handling
missstevenson01
 
S3 environment
missstevenson01
 
The Processor.pptx
missstevenson01
 
How Computers Work
missstevenson01
 
Lesson 3 - Coding with Minecraft - Variables.pptx
missstevenson01
 
Lesson 2 - Coding with Minecraft - Events.pptx
missstevenson01
 
Lesson 1 - Coding with Minecraft -Introduction.pptx
missstevenson01
 
Lesson2 - Coding with Minecraft - Events.pptx
missstevenson01
 
Ethical hacking trojans, worms and spyware
missstevenson01
 
Ethical hacking anti virus
missstevenson01
 
Ethical hacking introduction to ethical hacking
missstevenson01
 
S1 internet safety-chattingonline
missstevenson01
 
S3 wireframe diagrams
missstevenson01
 
Alien database
missstevenson01
 
Video Games and Copyright laws
missstevenson01
 
Games Design Document
missstevenson01
 
Video game proposal
missstevenson01
 
Evaluation
missstevenson01
 
H evaluation
missstevenson01
 
H file handling
missstevenson01
 
Ad

Recently uploaded (20)

PPTX
SCHOOL-BASED SEXUAL HARASSMENT PREVENTION AND RESPONSE WORKSHOP
komlalokoe
 
PPSX
Health Planning in india - Unit 03 - CHN 2 - GNM 3RD YEAR.ppsx
Priyanshu Anand
 
PPTX
How to Configure Access Rights of Manufacturing Orders in Odoo 18 Manufacturing
Celine George
 
PPTX
CONVULSIVE DISORDERS: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
PDF
1, 2, 3… E MAIS UM CICLO CHEGA AO FIM!.pdf
Colégio Santa Teresinha
 
PPTX
How to Manage Promotions in Odoo 18 Sales
Celine George
 
PPTX
LEGAL ASPECTS OF PSYCHIATRUC NURSING.pptx
PoojaSen20
 
PPTX
Nutri-QUIZ-Bee-Elementary.pptx...................
ferdinandsanbuenaven
 
PDF
BÀI TẬP BỔ TRỢ THEO LESSON TIẾNG ANH - I-LEARN SMART WORLD 7 - CẢ NĂM - CÓ ĐÁ...
Nguyen Thanh Tu Collection
 
PDF
IMP NAAC REFORMS 2024 - 10 Attributes.pdf
BHARTIWADEKAR
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
PPTX
How to Create Rental Orders in Odoo 18 Rental
Celine George
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PPTX
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
PDF
community health nursing question paper 2.pdf
Prince kumar
 
PPTX
Pyhton with Mysql to perform CRUD operations.pptx
Ramakrishna Reddy Bijjam
 
PPTX
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
PPTX
Explorando Recursos do Summer '25: Dicas Essenciais - 02
Mauricio Alexandre Silva
 
PPTX
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
PDF
IMP NAAC-Reforms-Stakeholder-Consultation-Presentation-on-Draft-Metrics-Unive...
BHARTIWADEKAR
 
SCHOOL-BASED SEXUAL HARASSMENT PREVENTION AND RESPONSE WORKSHOP
komlalokoe
 
Health Planning in india - Unit 03 - CHN 2 - GNM 3RD YEAR.ppsx
Priyanshu Anand
 
How to Configure Access Rights of Manufacturing Orders in Odoo 18 Manufacturing
Celine George
 
CONVULSIVE DISORDERS: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
1, 2, 3… E MAIS UM CICLO CHEGA AO FIM!.pdf
Colégio Santa Teresinha
 
How to Manage Promotions in Odoo 18 Sales
Celine George
 
LEGAL ASPECTS OF PSYCHIATRUC NURSING.pptx
PoojaSen20
 
Nutri-QUIZ-Bee-Elementary.pptx...................
ferdinandsanbuenaven
 
BÀI TẬP BỔ TRỢ THEO LESSON TIẾNG ANH - I-LEARN SMART WORLD 7 - CẢ NĂM - CÓ ĐÁ...
Nguyen Thanh Tu Collection
 
IMP NAAC REFORMS 2024 - 10 Attributes.pdf
BHARTIWADEKAR
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
How to Create Rental Orders in Odoo 18 Rental
Celine George
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
community health nursing question paper 2.pdf
Prince kumar
 
Pyhton with Mysql to perform CRUD operations.pptx
Ramakrishna Reddy Bijjam
 
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
Explorando Recursos do Summer '25: Dicas Essenciais - 02
Mauricio Alexandre Silva
 
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
IMP NAAC-Reforms-Stakeholder-Consultation-Presentation-on-Draft-Metrics-Unive...
BHARTIWADEKAR
 

H testing and debugging

  • 2. ‘Good’ software is… Robust Portable • Produces the correct output • from the correct input • Copes with invalid input data • Deals with unexpected conditions • Runs on different platforms such as OSX/Windows/Linux Reliable
  • 4. Lesson Aims By the end of this lesson all pupils will be able to: ❏ Describe the types of errors that may be discovered ❏ Explain what is meant by systematic testing ❏ Explain what is meant by comprehensive testing ❏ Explain the importance for documentation at every stage of the project
  • 5. A philosophical view… “Program testing can be a very effective way to show the presence of bugs, but it is hopelessly inadequate for showing their absence.” Edsger W. Dijkstra 1972 The Humble Programmer (1972) Hamilton Richards
  • 6. Testing What is the purpose of testing any product? ❏ Is it Fit for purpose - does it meet the specification ❏ Is it robust ❏ Is it reliable MURPHY’s LAW 1 The quicker program coding is started the longer the project will take MURPHY’s LAW 2 Murphy’s Law 1 is correct!
  • 7. Aspects of Testing Testing has to follow a plan. It has to be systematic it has to be comprehensive What are we testing? What is the function we want to test What data/actions do we need to perform to test this? What is the expected (correct) output?
  • 8. Aspects of Testing (cont.) In an ideal world testing would be exhaustive – meaning that every single possible condition would be tested This is unfortunately not the case. However your testing can be comprehensive One way is to ensure that you use a wide range of test data Modules can be tested individually Modules can also be tested to ensure that they integrate well
  • 9. Test Data Type Description Accepted Normal This is data that the program should be expected to use in normal operation YES Extreme This is data at the edge of what is acceptable, such as high and low limits or boundaries YES Exceptional This is invalid data. Robust programs should reject this NO
  • 10. A Testing table Imagine a program that accepted and graded pass marks between 0 and 20, a pass is 12 or more. You should show for each input what the expected output is and the actual output and make a comment. This may be as simple as ‘As Expected’
  • 11. Testing Table Type Input Expected Output Actual Output Comment NORMAL 2 FAIL FAIL As Expected 7 FAIL FAIL As Expected 12 PASS PASS As Expected EXTREME 0 FAIL FAIL As Expected 20 PASS PASS As Expected EXCEPTIONAL -1 Error Error Program Crashes 21 Error Error Program Crashes
  • 12. Phases of Testing Alpha Testing Internal testing Pre-Release Done by Development Team Beta Testing Testing a program in working conditions Members of public or independent test group Feedback provided to the development team
  • 13. Types of Errors (recap) When testing programs there will be errors (bugs) there are different types… 1. Syntax These are mistakes in the programming ‘grammar’ e.g. Forgetting to put a semi colon or close a bracket 1. Execution These are errors detected during run-time. Divide by zero etc. 1. Logic These are errors in the design of the program Passing the wrong data into a function Programs will fail translation so won't run Programs will run but give some unintended output Programs will usually fail during runtime
  • 14. Constructing a test plan The purpose of a test plan is to ensure that you are systematically and comprehensively testing your system The test plan must test the functionality of the software ❏ A successful test is one that finds errors! ❏ Try to find the errors!
  • 15. Test cases and Data What are your test cases? This can be thought of as the ‘user’ interaction with your system What test data will you use - your system may not be populated What data will you use in your system to ensure that your tests are valid?
  • 17. Debugging tools What if it finds an error? There are various debugging techniques/tools ❏ Dry Runs ❏ Trace Tables/Tools ❏ Breakpoints ❏ Watchpoints
  • 18. Dry Runs A dry run is when you manually stepping through the lines of code without the need for executing the program. Can be useful for logic errors.
  • 19. Trace table When you use a trace table you step through the code recording changes to variables. The changes can then be used to track when and what it is being changed to.
  • 20. Breakpoints You set breakpoints to stop execution of the code at specified lines of code. At this point the contents of variables can be examined This can be a method to ascertain if a piece of code is actually being executed, obviously useful for debugging conditional statements. As you can check if the variables match the conditions you think they do
  • 21. Allows execution to be halted and the contents of variables inspected Breakpoints in Python (Pycharm)
  • 22. Watchpoints Watchpoints are similar to breakpoints but they are assigned to variables They then stop the execution of the program only when the contents of a specific variable(s) meet a particular condition. This can be at any point in the execution of the code
  • 23. Watchpoint set for when counter == 1 Will halt the execution of the program when the variable counter changes to 1

Editor's Notes

  • #6: Edsger Wybe Dijkstra (11 May 1930 – 6 August 2002) was a Dutch computer scientist. He received the 1972 Turing Award for fundamental contributions to developing programming languages, and was the Schlumberger Centennial Chair of Computer Sciences at The University of Texas at Austin from 1984 until 2000. Shortly before his death in 2002, he received the ACM PODC Influential Paper Award in distributed computing for his work on self-stabilization of program computation. This annual award was renamed the Dijkstra Prize the following year, in his honor. (http://en.wikipedia.org/wiki/Edsger_W._Dijkstra)