Errors & Testing Flashcards

Week 1.6 (14 cards)

1
Q

syntax errors

A
  • incorrect use of syntax
  • found at run time
    • will report where it found an error
    • will report on the type of error
      • will not always be precise
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

syntax errors deep in the code

A
  • the stack trace is more useful in these situations
  • it locates the error but also the path to the error
  • requires careful reading
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

runtime errors

A
  • the interpreter cannot always immediately find an error
  • logical errors in program design
  • external input that causes errors
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

preventing errors

A
  • diagnosing error messages
  • careful programming to avoid syntax errors
  • careful design to avoid logical and run-time errors
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

defensive programming

A
  • sanitise all external input
  • anticipate and handle problems
    -should be used whenever we interact with the external environment
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what is the behaviour of code determined by

A
  • logical flow implemented in code
  • values that variables take during execution of the code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what should we anticipate with systematic testing

A
  • expected logical paths taken through the code
  • expected ranges of values of variables in the code and test appropriately
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what should the three things tests should cover

A
  1. size
  2. branching
  3. boundary (edge)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

types of size test cases

A
  • test the cases when the collection is empty
  • has a single element
  • has multiple entries
  • at the expected size during normal use
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

branch tests

A

where code deals with a set of distinct situations your test cases should test all possible paths

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

types of boundary tests

A

where your code has a boundary where its behaviour changes you should test:
- both sides of the boundary
- exactly the boundary case

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

assert in python

A
  • passes if it evaluates a Boolean expression as True
  • creates an AssertionError, stopping execution, if it evaluates as False
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

python my-function.py

A

assertions active

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

python -O my-function.py

A

assertions inactive

How well did you know this?
1
Not at all
2
3
4
5
Perfectly