Skip to content

Add automated tests and CI workflow for FastAPI backend - Method-section-generator/apps/backend/app/main.py #4

@vinitjain2005

Description

@vinitjain2005

Currently, the FastAPI backend (including backend/main.py and the associated API routes) does not appear to have automated tests. This makes it difficult to verify endpoint behavior, detect regressions, and safely extend functionality in the future.
Additionally, there is no CI workflow configured to automatically run tests on pull requests.

Describe the solution you'd like

I would like to:

  • Add a structured tests/ directory for the backend
  • Use pytest together with fastapi.testclient.TestClient

Implement tests for:

  • The root (/) endpoint
  • The /api routes defined in report_router

Validate:

  • HTTP status codes
  • Response structure
  • Required fields in returned JSON
  • Add a GitHub Actions workflow to automatically run tests on pull requests

This will improve reliability, maintainability, and confidence in future changes.

Describe alternatives you've considered
An alternative would be to rely on manual testing during development. However, automated testing ensures consistent validation and allows easier extension of functionality without introducing regressions.

Additional context
This change will not modify any existing functionality or scientific logic. It will focus solely on improving backend reliability and developer experience by introducing structured automated testing and CI integration.

Vinit Jain
GitHub: @vinitjain2005

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions