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

PPT
debugging and testing
PPTX
Software Testing and Debugging
PPT
Software testing strategies
PPTX
Testing and types of Testing
PPT
PPTX
11 software testing_strategy
PDF
Software Testing Techniques: An Overview
PPTX
Software Testing & Debugging
debugging and testing
Software Testing and Debugging
Software testing strategies
Testing and types of Testing
11 software testing_strategy
Software Testing Techniques: An Overview
Software Testing & Debugging

What's hot (19)

PPTX
Software Testing Fundamentals | Basics Of Software Testing
PPTX
PPTX
Research issues in object oriented software testing
PPTX
unit testing and debugging
PPT
Software Testing
PPTX
Software testing.ppt
PPTX
Testing in multiplatform environment
PPTX
Software Testing - Part 1 (Techniques, Types, Levels, Methods, STLC, Bug Life...
PPTX
Software Testing Technique in Software Engineering
PPTX
SOFTWARE TESTING UNIT-4
PPTX
Object Oriented Testing(OOT) presentation slides
PPTX
Testing (System Analysis and Design)
PPTX
Software testing methods
PPTX
Software testing
PPTX
Object oriented testing
PPTX
Software Testing Strategies
PPTX
Software Testing Strategies
PPTX
Structural and functional testing
Software Testing Fundamentals | Basics Of Software Testing
Research issues in object oriented software testing
unit testing and debugging
Software Testing
Software testing.ppt
Testing in multiplatform environment
Software Testing - Part 1 (Techniques, Types, Levels, Methods, STLC, Bug Life...
Software Testing Technique in Software Engineering
SOFTWARE TESTING UNIT-4
Object Oriented Testing(OOT) presentation slides
Testing (System Analysis and Design)
Software testing methods
Software testing
Object oriented testing
Software Testing Strategies
Software Testing Strategies
Structural and functional testing
Ad

Similar to H testing and debugging (20)

PPTX
SE - Lecture 8 - Software Testing State Diagram.pptx
PPTX
Software Testing Introduction (Part 1)
PPT
National 5 Computing Science - Testing
PDF
L software testing
PPT
Software testing and software development process
PPT
testing
PPS
Why Unit Testingl
PPS
Why Unit Testingl
PPS
Why unit testingl
PPT
Sdd Testing & Evaluating
PPS
Unit Testing
PPT
Testing concepts ppt
PPT
Testing concepts ppt
PPTX
Understanding Key Concepts and Applications in Week 11: A Comprehensive Overv...
PPT
SD & D Testing
PPTX
Debbuging
PPT
Testing
DOCX
Chapter 10 Testing and Quality Assurance1Unders.docx
PPTX
SOFTWARE TESTING.pptx
PPTX
1779905011SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.pptx
SE - Lecture 8 - Software Testing State Diagram.pptx
Software Testing Introduction (Part 1)
National 5 Computing Science - Testing
L software testing
Software testing and software development process
testing
Why Unit Testingl
Why Unit Testingl
Why unit testingl
Sdd Testing & Evaluating
Unit Testing
Testing concepts ppt
Testing concepts ppt
Understanding Key Concepts and Applications in Week 11: A Comprehensive Overv...
SD & D Testing
Debbuging
Testing
Chapter 10 Testing and Quality Assurance1Unders.docx
SOFTWARE TESTING.pptx
1779905011SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.pptx
Ad

More from missstevenson01 (20)

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

Recently uploaded (20)

PPTX
Lesson notes of climatology university.
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
Pharma ospi slides which help in ospi learning
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
TR - Agricultural Crops Production NC III.pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Sports Quiz easy sports quiz sports quiz
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Computing-Curriculum for Schools in Ghana
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Pre independence Education in Inndia.pdf
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PDF
Classroom Observation Tools for Teachers
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
master seminar digital applications in india
Lesson notes of climatology university.
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Pharma ospi slides which help in ospi learning
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
TR - Agricultural Crops Production NC III.pdf
human mycosis Human fungal infections are called human mycosis..pptx
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Sports Quiz easy sports quiz sports quiz
O7-L3 Supply Chain Operations - ICLT Program
Computing-Curriculum for Schools in Ghana
Abdominal Access Techniques with Prof. Dr. R K Mishra
Pre independence Education in Inndia.pdf
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
Classroom Observation Tools for Teachers
Microbial diseases, their pathogenesis and prophylaxis
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Anesthesia in Laparoscopic Surgery in India
master seminar digital applications in india

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)