Presentation is loading. Please wait.

Presentation is loading. Please wait.

Incremental Testing of Functions CSIS 1595: Fundamentals of Programming and Problem Solving 1.

Similar presentations


Presentation on theme: "Incremental Testing of Functions CSIS 1595: Fundamentals of Programming and Problem Solving 1."— Presentation transcript:

1 Incremental Testing of Functions CSIS 1595: Fundamentals of Programming and Problem Solving 1

2 Incremental Development Key idea: Build and test program one function at a time One method: – Start with “lower level” functions that do not call anything else Could build in order in which called, but not necessary – Implement functions that use tested methods If bug, most likely in function currently being developed – Finish with main program

3 Balloon Program Example Lowest level functions: – set_target() – get_velocity() – compute_miss(target, velocity, angle) – print_row(angle, miss_distance) Then build print_table(target, velocity) – Requires print_row be done first Then main program

4 Unit Testing Testing each function separately Requires – Function definition to be tested – Code to test the function Prompt for inputs (if any) Call function with inputs Print what it returns (if anything)

5 Unit Test Example

6 Unit Test Functions Can create “testing function” for each function – Should keep simple (just get input, call, and print) More complex testing function  More likely it has bugs! – Can use to retest a function at any time Bugs suspected Function changed in future versions) Do not delete!

7 Unit Test Function Example Can call from main during testing – If necessary, comment out actual main program during testing


Download ppt "Incremental Testing of Functions CSIS 1595: Fundamentals of Programming and Problem Solving 1."

Similar presentations


Ads by Google