handouts lectureslides lecture7 1

3
Tes$ng and Debugging Would be great if our code always worked properly the first $me we run it! But life ain’t perfect, so we need: Tes$ng methods Ways of trying code on examples to determine if running correctly Debugging methods Ways of fixing a program that you know does not work as intended

Upload: ed-deldel

Post on 13-Sep-2015

215 views

Category:

Documents


1 download

DESCRIPTION

fsggg

TRANSCRIPT

  • Tes$ng and Debugging

    Would be great if our code always worked properly the rst $me we run it!

    But life aint perfect, so we need: Tes$ng methods Ways of trying code on examples to determine if running correctly

    Debugging methods Ways of xing a program that you know does not work as intended

  • When should you test and debug?

    Design your code for ease of tes$ng and debugging Break program into components that can be tested and debugged independently

    Document constraints on modules Expecta$ons on inputs, on outputs Even if code does not enforce constraints, valuable for debugging to have descrip$on

    Document assump$ons behind code design

  • When are you ready to test?

    Ensure that code will actually run Remove syntax errors Remove sta$c seman$c errors Both of these are typically handled by Python interpreter

    Have a set of expected results (i.e. input-output pairings) ready