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

Write Unit Tests for backend #74

Open
4 tasks
yashpandey06 opened this issue Nov 20, 2024 · 4 comments
Open
4 tasks

Write Unit Tests for backend #74

yashpandey06 opened this issue Nov 20, 2024 · 4 comments

Comments

@yashpandey06
Copy link

yashpandey06 commented Nov 20, 2024


Tasks

  1. Set Up Testing Framework:

    • Install and configure pytest and pytest-flask for testing the application.
  2. Write Unit Tests for Routes:

    • Test each endpoint for expected behavior (e.g., HTTP status codes, JSON response structure, query parameters, and path parameters).
  3. Test Dependencies:

    • Mock external dependencies (e.g., databases, third-party APIs) using unittest.mock or pytest-mock.
  4. Test Application Context:

    • Ensure proper testing of the Flask app context and configurations.
  5. Organize Tests:

    • Place test files in the tests/ directory.
    • Use meaningful test function names and group related tests into separate files.
  6. Document Test Instructions:

    • Update the project README or contributing guide with steps to run tests locally.

Acceptance Criteria

  • All routes have at least one unit test.
  • External dependencies are mocked and tested effectively.
  • Tests are structured, organized, and easy to maintain.
  • All tests pass when executed using pytest.

References

@Jibesh10101011
Copy link
Contributor

@yashpandey06 , I would like to work on this issue can you please assign this to me ?

@bassamadnan
Copy link
Contributor

@Jibesh10101011 what would the tests look like? tests such as adding/removing images and confirming them from db are fine (or via routes which return back list of images). But i dont think you can test everything (tags returned by an image for example or clusters formed) since it depends on the models accuracy and the model we are using.

@Jibesh10101011
Copy link
Contributor

@bassamadnan I agree that we can test basic CRUD operations like adding/removing images and confirming them via routes or the database. However, testing aspects like tags or clusters is challenging as they depend on the model's accuracy and the specific model we’re using. For those, we might need to rely on manual validation or mock outputs for consistency in tests.

@yashpandey06
Copy link
Author

@Jibesh10101011 @bassamadnan

Agreed , we can move with testing CRUD operations which are independent of the model implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants