Skip to content

Set up Ktor integration tests with test engine #8

@GavT

Description

@GavT

Summary

There are no integration tests for the Ktor routes. Ktor provides a testApplication engine that runs the full stack in-memory without starting a real HTTP server.

What to add

  1. Add ktor-server-test-host to testImplementation dependencies
  2. Create RoutesTest.kt:
    • GET /api/health returns 200 when cache is ready
    • GET /api/search?postcode=SW1A1AA&radius=5 returns station list
    • GET /api/search without postcode returns 400
    • GET /api/search?postcode=INVALID returns appropriate error
  3. Use MockDataCache that bypasses UK Gov API calls

Workstream: WS2 Phase 2B

Metadata

Metadata

Assignees

No one assigned

    Labels

    WS2-testingWorkstream 2 – TestingtestingTest coverage task

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions