It's UWAweek 42 (2nd semester, week 12)

help5501

This forum is provided to promote discussion amongst students enrolled in CITS5501 Software Testing and Quality Assurance. If posting a question, it's suggested you check first whether your question is answered in the unit Frequently Asked Questions (FAQ) list, and use the search box (on the right) to see if an answer to your question has already been posted.

Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.

Note that any posts must comply with the UWA Code of Conduct and the UWA Academic Conduct Policy. That means you should (a) treat everyone with respect and courtesy, and (b) not post your solutions to an assessment that's in progress.

If asking a programming question, it's recommended you read How do I ask a good question? If reporting or troubleshooting a bug in software used in the unit, it's recommend you read How to report bugs effectively.
Displaying selected article
Showing 1 of 143 articles.
Currently 78 other people reading this forum.


 UWA week 42 (2nd semester, week 12) ↓
SVG not supported

Login to reply

👍?
helpful
12:18pm Mon 14th Oct, Arran S.

> Hi Arran,

> I've approached this question differently. For ISP I'm applying it to the fields of the objects and not the objects themselves, e.g. Instead of partitioning Location, I'm partitioning the name of Location.

In cases where a class consists of "plain old data" – i.e., the class doesn't do any significant abstraction or information hiding – then partitioning up a parameter of that class will amount to pretty much the same thing as partitioning up its fields. If the class does do information hiding or has invariants, then the domain might be smaller (and we might not have access to the fields at all).

Let's look at some concrete examples. If some method takes a primitive type as parameter (e.g. an int), then things seem straightforward – we partition up the range of possible ints. If the method specifically excludes some values as being undefined (maybe 0 is never allowed to be passed), then that makes our domain smaller.

If we have a class which basically is just a wrapper around, say, 3 ints, then we can partition objects of that class just by partitioning the individual ints.

But suppose we have a Date class, with year, month and day probably implemented as ints, but which are only exposed via "getter" methods (and which are presumably constrained by class invariants). A Date class presumably constrains the month to be in the range 1-12, and the day to be a valid day for the month. In that case, we don't have direct access to the field anyway, so it doesn't really make sense to talk about partitioning them, and even if we did, many of the possible int values are ruled out by the class specification. It would make more sense to partition the class based on properties like: is this the first or last month of the year? Is the year positive, 0 or negative? (We're unlikely to schedule meetings for 10 BCE, but I suppose historians might like to accurately model such dates.) Is the day the first or last day of the month? (And if we are testing a constructor which promises to throw exceptions when an invalid day is supplied, our partitions would include invalid days as well - but those would be partitions used for testing the constructor of class Date, not partitions for methods that use class Date or take it as a parameter.)

Does that assist at all?

cheers

Arran

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  8:08AM Aug 25 2024
Privacy policy