Skip to content

Commit 7ca8ad6

Browse files
authored
Merge pull request #197 from solomonng2001/add-sort-test-cases-and-effort-in-developer-guide
Add sort test cases and effort in developer guide
2 parents e56eb16 + c5dab03 commit 7ca8ad6

File tree

1 file changed

+76
-3
lines changed

1 file changed

+76
-3
lines changed

docs/DeveloperGuide.md

Lines changed: 76 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,7 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli
606606
Steps 1a1-1a3 are repeated until the data entered are correct.<br>
607607
Use case resumes at step 2.
608608

609+
609610
**Use case: UC05 - View client details and policies**
610611

611612
**MSS**
@@ -626,7 +627,6 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli
626627
Use case ends.
627628

628629

629-
630630
**Use case: UC06 - Find a client by name**
631631

632632
**MSS**
@@ -647,6 +647,7 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli
647647
* 1b1. ClientCare lets user know that the list is empty.<br>
648648
Use case ends.
649649

650+
650651
**Use case: UC07 - Adding notes to a client**
651652

652653
**MSS**
@@ -688,12 +689,25 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli
688689
Steps 1a1-1a3 are repeated until the data entered are correct.<br>
689690
Use case resumes at step 2.
690691

692+
691693
**Use case: UC09 - Sort clients**
692694

693695
**MSS**
694-
1. PLACEHOLDER
696+
1. User requests to sort clients by `CRITERIA` and `ORDER`.
697+
2. ClientCare sorts the clients by the specified criteria and order.
698+
3. ClientCare shows a success message to the user.<br>
699+
Use case ends.
695700

696701
**Extensions**
702+
* 1a. ClientCare detects that the given command is invalid.
703+
* 1a1. ClientCare shows an error message.
704+
Use case ends.
705+
* 1b. ClientCare detects that the given `CRITERIA` is invalid.
706+
* 1b1. ClientCare shows an error message.
707+
Use case ends.
708+
* 1c. ClientCare detects that the given `ORDER` is invalid.
709+
* 1c1. ClientCare shows an error message.
710+
Use case ends.
697711

698712

699713
**Use case: UC10 - Update client as met**
@@ -717,6 +731,7 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli
717731
* 1c1. ClientCare shows an error message.<br>
718732
Use case ends.
719733

734+
720735
**Use case: UC11 - Update last met overdue duration**
721736

722737
**MSS**
@@ -735,7 +750,8 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli
735750
* 1b. ClientCare detects that the given input entered is not a non-negative integer.
736751
* 1b1. ClientCare shows an error message.<br>
737752
Use case ends.
738-
753+
754+
739755
**Use case: UC12 - Schedule an appointment with client**
740756

741757
**MSS**
@@ -781,6 +797,7 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli
781797
* 1c1. ClientCare shows an error message.<br>
782798
Use case ends.
783799

800+
784801
**Use case: UC14 - Add policies to client**
785802

786803
**MSS**
@@ -803,6 +820,7 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli
803820
* 1c1. ClientCare shows an error message.<br>
804821
Use case ends.
805822

823+
806824
**Use case: UC15 - Delete policies from client**
807825

808826
**MSS**
@@ -825,6 +843,7 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli
825843
* 1c1. ClientCare shows an error message.<br>
826844
Use case ends.
827845

846+
828847
### Non-Functional Requirements
829848

830849
1. Should work on any _mainstream OS_ as long as it has Java `11` or above installed.
@@ -1041,6 +1060,54 @@ testers are expected to do more *exploratory* testing.
10411060

10421061
### Sorting clients
10431062

1063+
1. Sorting clients by priority
1064+
1065+
1. Prerequisites: Multiple clients in the client list.
1066+
1067+
2. Test case (valid descending): `sort priority o/desc`<br>
1068+
Expected: Clients are sorted by priority in descending order. Success message shown in the status message.
1069+
1070+
3. Test case (valid ascending): `sort priority o/asc`<br>
1071+
Expected: Clients are sorted by priority in ascending order. Success message shown in the status message.
1072+
1073+
4. Test case (invalid order): `sort priority o/invalid`<br>
1074+
Expected: Clients are not sorted. Error message shown in the status message.
1075+
1076+
5. Test case (invalid criteria): `sort invalid o/asc`<br>
1077+
Expected: Similar to previous.
1078+
1079+
2. Sorting clients by name
1080+
1081+
1. Prerequisites: Multiple clients in the client list.
1082+
1083+
2. Test case (valid ascending): `sort name o/asc`<br>
1084+
Expected: Clients are sorted by name in ascending order. Success message shown in the status message.
1085+
1086+
3. Test case (valid descending): `sort name o/desc`<br>
1087+
Expected: Clients are sorted by name in descending order. Success message shown in the status message.
1088+
1089+
4. Test case (invalid order): `sort name o/invalid`<br>
1090+
Expected: Clients are not sorted. Error message shown in the status message.
1091+
1092+
5. Test case (invalid criteria): `sort invalid o/asc`<br>
1093+
Expected: Similar to previous.
1094+
1095+
3. Sorting clients by birthday
1096+
1097+
1. Prerequisites: Multiple clients in the client list.
1098+
1099+
2. Test case (valid ascending): `sort birthday o/asc`<br>
1100+
Expected: Clients are sorted by birthday in ascending order. Success message shown in the status message.
1101+
1102+
3. Test case (valid descending): `sort birthday o/desc`<br>
1103+
Expected: Clients are sorted by birthday in descending order. Success message shown in the status message.
1104+
1105+
4. Test case (invalid order): `sort birthday o/invalid`<br>
1106+
Expected: Clients are not sorted. Error message shown in the status message.
1107+
1108+
5. Test case (invalid criteria): `sort invalid o/asc`<br>
1109+
Expected: Similar to previous.
1110+
10441111
### Updating last met
10451112

10461113
1. Updating the last met of a client while all clients are being shown
@@ -1292,6 +1359,12 @@ Additional testing was needed to ensure that the policies are saved correctly an
12921359
As to keep the `Person` object immutable, we had to create a new `Person` object with the updated policy list when adding or deleting a policy. This made testing for the `addpolicy` and `deletepolicy` commands more difficult as the `addressbook` object prevents us from directly updating the `Person` object. Thus, more methods have to be implemented in `ModelManger` class to enable proper updating of the expected `AddressBook` object when testing.
12931360

12941361
**3. Additional Client Traits and Features**<br>
1362+
Difficulty Level: 3/5<br>
1363+
Effort Required: 3/5<br>
1364+
Challenges faced: When implementing sorting of clients, the challenge was understanding the design principles behind how `ModelManager#filteredPersons` was implemented in AB3. Since this is an iterative project, we had to ensure that the principles were consistent.
1365+
For instance, we recognised that `ModelManager#filteredPersons` was an immutable list, and thus our initial implementation of removing the `final` keyword from the `filteredPersons` field was incorrect and broke the design principles. We had to revert this change and design an alternative solution that adhered to the design principles.
1366+
This took some time to understand and implement correctly. `Birthday` and `Priority` are extensions of the `Person` model and required classes of their own. `DateUtil` and `DateTimeUtil` classes were additionally created to handle dates and times, which was used widely, and thus had to be well-designed to ensure utility and prevent bugs.
1367+
Testing for most features were very extensive, with multiple edge cases and invalid inputs. Quality of design was ensured and priorities over shortcut alternatives. For instance, data structures like `HashMap` was utilised to map string inputs to `PriorityValue` enums. All these quality design required time and effort.
12951368

12961369
**4. GUI**<br>
12971370
Difficulty Level: 3/5<br>

0 commit comments

Comments
 (0)