Uc001 Create Task
# specs/features/UC001-create-task.feature
#
# SINGLE SOURCE OF TRUTH for UC001 behaviour.
# This file is:
# (1) referenced by specs/use_cases/UC001-create-task.md (documentation)
# (2) executed by the acceptance test suite (living documentation)
#
# Rules:
# - Scenario IDs (e.g. UC001-S01) must match the use case document.
# - Step definitions live in: src/test/java/.../steps/
# - Keep scenarios focused: one behaviour per scenario.
# - Use exact terms from specs/glossary.md.
Feature: Create Task
As a User
I want to create a new Task
So that I can track a unit of work
Background:
Given the task list is empty
# ---------------------------------------------------------------------------
# Happy path
# ---------------------------------------------------------------------------
Scenario: UC001-S01 Successfully create a task with all fields
When the User creates a task with title "Fix login bug", description "Session cookie missing", status "TODO", and due date "2026-06-30"
Then the response status is 201
And the response contains a task with title "Fix login bug"
And the response contains a task with description "Session cookie missing"
And the response contains a task with status "TODO"
And the response contains a task with due date "2026-06-30"
And the response contains a task with a non-null id
And the response contains a task with a non-null createdAt
Scenario: UC001-S02 Successfully create a task with only required fields
When the User creates a task with title "Minimal task" and status "IN_PROGRESS"
Then the response status is 201
And the response contains a task with title "Minimal task"
And the response contains a task with status "IN_PROGRESS"
And the response contains a task with a null description
And the response contains a task with a null due date
# ---------------------------------------------------------------------------
# Validation — BR-001: Title is required
# ---------------------------------------------------------------------------
Scenario: UC001-S03 Reject task creation when title is blank
When the User creates a task with title "" and status "TODO"
Then the response status is 400
And the response error code is "TASK_TITLE_REQUIRED"
Scenario: UC001-S04 Reject task creation when title is null
When the User creates a task with a null title and status "TODO"
Then the response status is 400
And the response error code is "TASK_TITLE_REQUIRED"
# ---------------------------------------------------------------------------
# Validation — BR-002: Title max 100 characters
# ---------------------------------------------------------------------------
Scenario: UC001-S05 Reject task creation when title exceeds 100 characters
When the User creates a task with a title of 101 characters and status "TODO"
Then the response status is 400
And the response error code is "TASK_TITLE_TOO_LONG"
# ---------------------------------------------------------------------------
# Validation — BR-003: Description max 500 characters
# ---------------------------------------------------------------------------
Scenario: UC001-S06 Reject task creation when description exceeds 500 characters
When the User creates a task with title "Valid title", a description of 501 characters, and status "TODO"
Then the response status is 400
And the response error code is "TASK_DESCRIPTION_TOO_LONG"
# ---------------------------------------------------------------------------
# Validation — BR-006: Due date must be a valid date
# ---------------------------------------------------------------------------
Scenario: UC001-S07 Reject task creation when due date is not a valid date
When the User creates a task with title "Valid title", status "TODO", and due date "not-a-date"
Then the response status is 400
And the response error code is "TASK_DUE_DATE_INVALID"