-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[#11826] Add unit tests for SubmitFeedbackResponsesAction #12234
[#11826] Add unit tests for SubmitFeedbackResponsesAction #12234
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your PR! To answer your questions:
- No need to stub them, current approach is alright. However, do note that as part of our ongoing database migration project, our test code will undergo an overhaul as well, so dependencies may be mocked in the future. We will aim to have your PR resolved before then so that you won't have to make too many changes to your PR.
- Yes, no need to test this.
- Looks alright to me.
Some slight adjustments on my end. Personally I would also say that some private helper functions are not very necessary, but it's not a big issue.
src/test/java/teammates/ui/webapi/SubmitFeedbackResponsesActionTest.java
Outdated
Show resolved
Hide resolved
src/test/java/teammates/ui/webapi/SubmitFeedbackResponsesActionTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
No worries regarding what I mentioned previously about the abstraction of private helper functions. Whether a piece of code is over-abstracted is rather subjective, which is why I did not request for further changes.
For your own learning, though, the SWE @ Google chapter on unit testing explains DRY in testing pretty well, so it's worth a read!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work on this!
We will merge this into main, but do note that we are currently working on an overhaul of the backend, including the tests. These test classes will be removed or migrated in the month or so.
SubmitFeedbackResponsesAction has dependencies on several other classses. Should these dependencies by stubbed? From similar unit tests of other components, dependencies are not subbed.
Unit Tests here is really a misnomer. These really should be called integration tests instead. We are looking to change this in the near future with a more traditional mix of unit and integration tests. Feel free to have a look if you are interested, though note that the tests on this branch require a few more rounds of polishing before I would consider them ready to be merged.
Fixes #11826
Questions: