Presentation is loading. Please wait.

Presentation is loading. Please wait.

Testing Programs with Loops CSIS 1595: Fundamentals of Programming and Problem Solving 1.

Similar presentations


Presentation on theme: "Testing Programs with Loops CSIS 1595: Fundamentals of Programming and Problem Solving 1."— Presentation transcript:

1 Testing Programs with Loops CSIS 1595: Fundamentals of Programming and Problem Solving 1

2 Testing Programs with Loops Infinite number of possible cases – cannot test them all! Basic test cases: – Case where go through loop once Make sure code inside loop works, and can exit loop Wrong guess first time, correct guess second time – Case where go through loop multiple times Make sure executing code multiple times does not cause errors Wrong guess multiple times – Case where never enter loop (condition false first time) Make sure not executing loop code does not cause errors Correct guess first time

3 Example Bug only apparent in case loop never entered

4 “Off by one” Errors Execute one too many or one too few times Initial values set incorrectly

5 Scaffolding in Loops Print values each time through loop – Intermediate values – Counts…


Download ppt "Testing Programs with Loops CSIS 1595: Fundamentals of Programming and Problem Solving 1."

Similar presentations


Ads by Google