Testing — Menu-Driven CLI App¶
Test the CLI commands first, then the interactive menu.
CLI Commands¶
Add Tasks¶
cd ~/projects/taskman
bash taskman.sh add "Buy milk" --priority high
bash taskman.sh add "Write readme"
bash taskman.sh add "Clean desk" --priority low
[OK] Task added: #1 Buy milk [high]
[OK] Task added: #2 Write readme [normal]
[OK] Task added: #3 Clean desk [low]
List Tasks¶
ID Status Priority Task
---- ------ -------- ----
1 ○ high Buy milk
2 ○ normal Write readme
3 ○ low Clean desk
Mark Done¶
[OK] Task #1 marked done
ID Status Priority Task
---- ------ -------- ----
1 ✓ high Buy milk
2 ○ normal Write readme
3 ○ low Clean desk
Delete a Task¶
[OK] Task #3 deleted
ID Status Priority Task
---- ------ -------- ----
1 ✓ high Buy milk
2 ○ normal Write readme
Test Edge Cases¶
Add Without Description — Should Prompt¶
Task description: [OK] Task added: #4 Prompted task [normal]
Invalid Priority¶
Error: priority must be low, normal, or high
Exit: 1
Done on Non-Existent ID¶
Error: task #999 not found
Exit: 1
Empty Task Description¶
Task description: Error: description cannot be empty
Exit: 1
Verify Database File¶
1:done:high:Buy milk
2:pending:normal:Write readme
4:pending:normal:Prompted task
IDs are never reused — ID 3 is gone, IDs are sequential from the max.
Test SHOW_DONE Setting¶
ID Status Priority Task
---- ------ -------- ----
2 ○ normal Write readme
4 ○ normal Prompted task
Test Piped Output (No Colors)¶
0
Interactive Menu Test (Manual)¶
Navigate through the menu manually: 1. Select 1 to list tasks 2. Select 2 to add a task 3. Enter "Interactive task" as description 4. Select 6 to quit
Verify the new task appears in tasks.db.
Checklist¶
□ add creates a task with the correct ID, status, and priority
□ list shows all tasks in a formatted table
□ done marks the correct task (verified in tasks.db)
□ delete removes the task (ID not reused)
□ SHOW_DONE=false hides completed tasks
□ Invalid priority returns exit code 1 with clear message
□ Non-existent ID for done/delete returns exit code 1
□ Colors absent when output is piped
□ Interactive menu reaches all commands
□ shellcheck taskman.sh returns 0 warnings