Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discovery - Mock server improvements - Happy Paths, Errors, and standardization #194

Closed
17 of 21 tasks
adamwhitlock1 opened this issue Nov 14, 2024 · 3 comments
Closed
17 of 21 tasks
Assignees
Labels
engineering enhancement New feature or request

Comments

@adamwhitlock1
Copy link
Collaborator

adamwhitlock1 commented Nov 14, 2024

User Story

As an engineer, I want to investigate approaches for standardizing mock API responses across the VA application ecosystem, focusing initially on the most commonly used endpoints, to reduce duplication of effort and improve local development experience.

Background

Mock responses are scattered across repositories (vets-api, vets-website) and implemented inconsistently. This leads to:

  • Duplicate effort in maintaining mock data
  • Inconsistent response structures
  • Limited reusability across applications
  • Potential divergence from actual API behavior
  • Difficulty in simulating different data scenarios

Discovery Goals

  1. Current State

    • Document existing mock server implementations
      • vets-website local mock server
        • applications using mock server
      • vets-api mock data
      • MSW usage in tests
      • Cypress intercepts in e2e tests
    • Identify most frequently used endpoints across applications
    • Analyze current mock response patterns in regards to what we can standardize, and where data inconsistencies
  2. Response Structure Investigation

    • Study in_progress_forms/{FORM_ID} responses across different forms
    • Identify common fields and patterns
    • Document variations and special cases
  3. Technical Approaches Evaluation

    • Evaluate MSW for browser-based mocking for maintainability, conciseness, and reusability
    • Compare with current Mocker-api/Express-based mock server
    • Assess feasibility of sharing mock data between vets-api and vets-website

Questions to Answer

  • What are the minimum required fields for common endpoint responses?
  • Can we create a tiered approach with basic/extended mock responses?
  • How can we maintain mock data consistency with real API changes?
  • What's the developer experience impact of different mocking approaches?
    • Can we make the experience better with combined responses that can be utilized within various environments (unit tests, e2e, local browser)

Resources

Deliverables

  1. Analysis document covering:

    • Current state assessment
    • Identified patterns and inconsistencies
    • Technical approach recommendations
    • Implementation considerations
  2. Proof of concept implementing recommended approach for 2-3 common endpoints

Success Criteria

  • Clear understanding of current mock data landscape
  • Documented patterns for standardizing responses
  • Technical recommendation with pros/cons analysis
  • Working proof of concept for selected approach

Constraints & Considerations

  • Must support existing applications without breaking changes
  • Should align with actual API behavior
  • Consider impact on testing infrastructure
  • Consider maintenance overhead

Review Needed By

  • VA Product Ownder
  • Product Manager
  • UX Research Team
  • Engineering Team

Definition of Done

  • Analysis document completed and reviewed
  • Technical approach recommendation made
  • Proof of concept implemented
  • Next steps documented
@adamwhitlock1 adamwhitlock1 added engineering enhancement New feature or request labels Nov 14, 2024
@bellepx0 bellepx0 self-assigned this Nov 25, 2024
@bellepx0
Copy link
Collaborator

bellepx0 commented Dec 3, 2024

Completed part 1 of discovery. Parts 2 and 3 will be addressed in upcoming sprints.
Discovery part 1 doc

@bellepx0
Copy link
Collaborator

Completed parts 2 and 3 of discovery, including proof-of-concept. Doc here.

@adamwhitlock1
Copy link
Collaborator Author

I reviewed the POC branch and it works as expected.

Really great work on doing some foundational exploration into this type of idea @bellepx0 !

I also added some additional notes and general thoughts at the bottom of your google doc. We can close this as done now, and revisit next steps after the holiday / next sprint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
engineering enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants