The tutor to confirm the following has been done.
Admin tP v1.2: Demo
v1.2
(or v1.2b
, if applicable). Take screenshots of each available feature in action. Add those screenshots to your collaborative project notes document with an appropriate heading e.g., v1.2 features demo
. Alternatively, you can screen-record a demo, upload it to somewhere, and post the link in the project notes document.Textbook Testing → Test Coverage
Can explain test coverage
Test coverage is a metric used to measure the extent to which testing exercises the code i.e., how much of the code is 'covered' by the tests.
Here are some examples of different coverage criteria:
if
statement evaluated to both true
and false
with separate test cases during testing is considered 'covered'. if(x > 2 && x < 44)
is considered one decision point but two conditions.
For 100% branch or decision coverage, two test cases are required:
(x > 2 && x < 44) == true
: [e.g. x == 4
](x > 2 && x < 44) == false
: [e.g. x == 100
]For 100% condition coverage, three test cases are required:
(x > 2) == true
, (x < 44) == true
: [e.g. x == 4
](x < 44) == false
: [e.g. x == 100
](x > 2) == false
: [e.g. x == 0
]Exercises
Highest intensity coverage
Which of these gives us the highest intensity of testing?
(b)
Explanation: 100% path coverage implies all possible execution paths through the SUT have been tested. This is essentially ‘exhaustive testing’. While this is very hard to achieve for a non-trivial SUT, it technically gives us the highest intensity of testing. If all tests pass at 100% path coverage, the SUT code can be considered ‘bug free’. However, note that path coverage does not include paths that are missing from the code altogether because the programmer left them out by mistake.
Can explain how test coverage works
Measuring coverage is often done using coverage analysis tools. Most IDEs have inbuilt support for measuring test coverage, or at least have plugins that can measure test coverage.
Coverage analysis can be useful in improving the quality of testing e.g., if a set of test cases does not achieve 100% branch coverage, more test cases can be added to cover missed branches.
Measuring code coverage in Intellij IDEA
An association class represents additional information about an association. It is a normal class but plays a special role from a design point of view.
A Man
class and a Woman
class are linked with a ‘married to’ association and there is a need to store the date of marriage. However, that data is related to the association rather than specifically owned by either the Man
object or the Woman
object. In such situations, an additional association class can be introduced, e.g. a Marriage
class, to store such information.
UML Class Diagrams → Association Classes → What UML/AssociationClasses
There is no special way to implement an association class. It can be implemented as a normal class that has variables to represent the endpoint of the association it represents.
In the code below, the Transaction
class is an association class that represents a transaction between a Person
who is the seller and another Person
who is the buyer.
class Transaction {
//all fields are compulsory
Person seller;
Person buyer;
Date date;
String receiptNumber;
Transaction(Person seller, Person buyer, Date date, String receiptNumber) {
//set fields
}
}
Can interpret association classes in class diagrams
Association classes are denoted as a connection to an association link using a dashed line as shown below.
In this example Loan
is an association class because it stores information about the borrows
association between the User
and the Book
.
OODM for the Course domain
(i) Draw an OODM for the description below, about how in some universities, these are called modulescourses work in a certain university:
A course has a name and a code. A course is read by 10 or more students, and taught by a team of instructors one of whom is the coordinator. A course can have a number of tasks which can be assignments or tests. Some assignments are compulsory. When a student attempts a task, a grade and an optional feedback is given.
Example OODM
(ii) Which type of a UML diagram would you use to illustrate the following situation?
The course CS101 Intro to CS is taught by Prof Lee. It has two optional assignments and one test.
Model workflow of Burger shop
Draw an activity diagram to represent the following workflow a burger shop uses when processing an order by a customer.
Example Activity Diagram