-
Notifications
You must be signed in to change notification settings - Fork 101
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
Proposal: Writing unit tests for api/ #506
Comments
@jayantbh cc |
Thank you for opening the issue, @thesujai. :) Any help is welcome. :) |
I am taking this on, you can assign me. I will create one PR for a .py file in api/(or adjust it not letting a PR be too long and non-reviewable). |
@thesujai Would like to know how you plan to achieve this before you start working on this. Although the current tests are not for APIs, they are for most of the core analytical functions that are used across the code base and in the APIs. API tests do make sense, would love to know your approach. |
@thesujai ^ would like to know that. |
@jayantbh @samad-yar-khan
Now for each API endpoint we will use this client to make requests, and match the actual response with the expected response. For example if we take the endpoint
The above one I showed is a success case. There can be some 400, or 500 cases which also need to be checked. So for them, I will be asserting, for a bad request, if the server responding with an error(Or is the server behaving unexpectedly) One thing I can say is writing tests won't be as straightforward as it looks, lots of API endpoints are a little tricky and would require some complex mocking. Anyway, I would try to do some actual data testing(Avoiding mocks in someplace). |
Please let me know what you think about this approach, open to suggestions! |
@thesujai you working on this ? |
Why do we need this ?
If I can correctly infer the backend/ directory structure, I observe tests/ directory is structured to give tests as per the mhq/ dir. I only see tests for service/. No api tests are there.
Tests looks like
good-to-have
but it is a critical part of code imo.Acceptance Criteria
Further Comments / References
I have some good experience writing tests(not more than a year though:)). I can provide pretty good coverage for this.
The text was updated successfully, but these errors were encountered: