Skip to document
This is a Premium Document. Some documents on Studocu are Premium. Upgrade to Premium to unlock it.

CSC1015F Testing and Debugging

Notes
Course

Computer science1015 (CSC1015F)

257 Documents
Students shared 257 documents in this course
Academic year: 2021/2022
Uploaded by:
Anonymous Student
This document has been uploaded by a student, just like you, who decided to remain anonymous.
University of Cape Town

Comments

Please sign in or register to post comments.

Related Studylists

studycsc1015fRhodes

Preview text

Errors What is an error?

  • when your program does not behave as intended or expected.

What is a bug?

  • An error

Debugging

  • the art of removing bugs

Types of Errors - When (1)

  • “Compile” time error
  • discovered when program is checked by the Python interpreter, before its run.
  • a result of improper use of Python language
  • usually Syntax Errors
  • e.

Types of Errors - When (2)

  • Run-time Error

  • Program structure is correct, but does not execute as expected

  • e. x = 0 y = 15/x

  • Examples of Python runtime errors

  • division by zero

  • performing an operation on incompatible types

  • using an identifier which has not been defined

Types of Errors - Why (1)

  • Syntax error
  • Program does not pass checking/ compiling stage
  • improper use of python language
  • e. product = x y

grammaticalerrorsmissingfullstopspellingmistakeetc product

Imissing 11 operator

divisionbyzero

multiplyinganumberwithastring 1 character

  • Common Python syntax errors
  • leaving out a keyword
  • putting a keyword in the wrong place
  • leaving out a symbol, such as a colon, comma or bracket
  • misspelling a keyword
  • incorrect indentation

Types of Errors - Why (2)

  • Logic Error
  • program passes checking/ compiling and runs but produces incorrect results or no results - because of a flaw in the algorithm or implementation of algorithm
  • e. product = x + y
singleequalsigninsteadofadoubleequaltosign

loopsfunctionsetc

akasemanticerror

statementsareincorrect

there'snoerrorintheprogramitselftheerrorisinthelogic

shouldbesum
oroperatorshouldbetx
programwillexecutebutitdoesn'tprovideyouwiththecorrectoutput incorrectoutput

Examples

LogicErroruT

SyntaxerroirT
  • Random testing
  • a subset of values in the input domain is used for testing
  • important to ensure that values are distributed over input domain
  • can use random number generation

Equivalence Classes & Boundary Values

  • Equivalence classes: Group input values into sets of values with similar expected behaviour and choose candidate values e. (100, -90, 10000) & (40000, 100000)

  • Boundary value analysis: choose values at, and on either side of, the boundaries of the equivalence classes- e. 9999, 10000, 10001

1

generator

defthresholdCrab

itrainoooovaltoooo
t
returnval

2 classes 10000 ibelow Tabore 10000

e 1,23,45,

checkingvalueat 5 test 446
Incorrectanswerfor 2 cases
  • Path testing

  • create test cases to test every path of execution of the program at least once.

  • Statement coverage

testwithvaluesoneitherside

Differentpaths

ifstatementtrueorfalse

conditions

forloopvalueis
withinthelooporoutsidetheloop

Whiteloopin 1 outofthelooptrueorfalse

conditions

eachstatementisexecutedatleastonce

Write a program to convert decimal numbers to binary Decimal to Binary Conversion

Notimportantrightnowjustwanttotest

Equivalenceclasses valueslessthanzero decimalslessthanzero

numbersfromzeroup

Boundaryvalues io 1

Statementcoverage

singlevalueissufficient 1101

Pathcoverage

5 to
Was this document helpful?
This is a Premium Document. Some documents on Studocu are Premium. Upgrade to Premium to unlock it.

CSC1015F Testing and Debugging

Course: Computer science1015 (CSC1015F)

257 Documents
Students shared 257 documents in this course
Was this document helpful?

This is a preview

Do you want full access? Go Premium and unlock all 7 pages
  • Access to all documents

  • Get Unlimited Downloads

  • Improve your grades

Upload

Share your documents to unlock

Already Premium?
!
Errors!
What is an error?!
when your program does not behave as intended or expected.!
!
What is a bug?!
An error!
!
Debugging!
the art of removing bugs!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
Types of Errors - When (1)!
“Compile” time error!
- discovered when program is checked by the Python interpreter, before its run.!
- a result of improper use of Python language !
- usually Syntax Errors!
- e.g. !
!
!
Types of Errors - When (2)!
Run-time Error!
- Program structure is correct, but does not execute as expected!
- e.g. x = 0 !
# y = 15/x!
!
- Examples of Python runtime errors!
#- division by zero!
#- performing an operation on incompatible types!
#- using an identifier which has not been defined!
#!
Types of Errors - Why (1)!
Syntax error!
- Program does not pass checking/ compiling stage!
- improper use of python language!
- e.g. product = x y !
!
grammatical
errors
missing
full
stop
spelling
mistake
etc
product Imissing
11operator
division
by
zero
multiplying
anumber
with
a
string
1
character

Why is this page out of focus?

This is a Premium document. Become Premium to read the whole document.

Why is this page out of focus?

This is a Premium document. Become Premium to read the whole document.