1 / 13

Session 20

Session 20. Debriefing HW3 Testing HW3. What I looked for in BoundedInteger. Did it compile and run with your tester? Did it compile with my tester (did it conform to the specs)? Did you provide all EXPLICIT requirements? Did you provide all IMPLICIT requirements?.

joanlouis
Download Presentation

Session 20

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Session 20 Debriefing HW3 Testing HW3

  2. What I looked for in BoundedInteger • Did it compile and run with your tester? • Did it compile with my tester (did it conform to the specs)? • Did you provide all EXPLICIT requirements? • Did you provide all IMPLICIT requirements?

  3. What do I mean by implicit requirements?? • Will addition and subtraction handle all int values of input? • “Large” • Negative • Will the code work with non-zero lower bounds?

  4. Other things in BoundedInteger • IVS are private • No extra IVs • Reasonable style • Using helper methods? • Constructors? • setValue() uses isLegal() • equals() uses equivalentX() • add() uses increment() or vice versa • Using logic appropriately • Don’t put ifs in methods that return boolean values. • Boolean versus boolean

  5. Access methods and the “same” class • Several of you wrote code that said: if (this.getLowerLimit() == other.getLowerLimit() … • But you actually CAN say: if (this.lowerLimit == other.lowerLimit … • Why doesn’t this violate the principle of “private”

  6. What I looked for in your tester • Did you name it correctly? • Test both constructors? • Test all fourteen methods? • Did you REALLY test all methods? • Note: How YOU test maybe different from how _I_ would test (whitebox versus blackbox testing).

  7. Testing Thoughts • Constructors • Valid bounds, valid start • Valid bounds, invalid start • Valid bounds, no start • Invalid bounds, “valid” start • Invalid bounds, “invalid” start • Invalid bounds, no start • Furthermore, at least ONE attempt to make an instance with negatives involved

  8. Testing Thoughts • Mathematical operators • Add/Sub positive number with no roll over. • Add/Sub positive numbers with “just” roll over. • Add/Sub positive numbers with significant roll over. • Add/Sub positive numbers with “double” roll over. • Test some of the above with different lower limits (make sure it isn’t a fluke) • Repeat all of above with negative number inputs.

  9. Testing • Accessors (getValue, toString) • PROBABLY only need to test each method once since WHAT they do isn’t state dependent. • Mutator (setValue) • Probably want to fence post (both sides of both limits) • You need to test BOTH pieces of functionality (modification and return value)

  10. Testing • Comparison operators (black/white issue again) • Equals (technically eight combinations to test) • Same value, same upper, same lower • Same value, same upper, different lower • Same value, different upper, same lower • Same value, different upper, different lower • Different value, same upper, same lower • Different value, same upper, different lower • Different value, different upper, same lower • Different value, different upper, different lower

  11. Testing • Comparison operators (black/white issue again) • Equivalent Value • Technically we only need to look at Same/Diff value • But I actually tested all eight cases from above • Equivalent Limits • Similar here. • isValid • Fenceposting again

  12. A “larger” problem that most of you didn’t think about • What happens if either or both bounds are close to the actual bounds of an int??? BoundedInteger bi=new BoundedInteger(0,Integer.MAX_VALUE) bi.add(Integer.MAX_VALUE); bi.add(3);

  13. Exam #1 on Wednesday • Based on lectures and readings • Based on CONCEPTS and not code writing • Understand vocabulary • Be able to explain the basic concepts of the course so far

More Related