Refactoring for Unit Test Access Controls
Part of #12048
Issue
After most of the Unit Test migration in #12048, there are a lot of inconsistencies in access control test methods. This is because we did not migrate the many convenient, abstracted, and commonly used access control test methods from ui/webapi/BaseActionTest.java to sqlui/webapi/BaseActionTest.java.
After merging #13254, all of the access control test methods in BaseActionTest.java have been migrated. Hence, this issue aims to refactor the unit test access controls to use these convenient test methods.
Progress
The progress for this refactoring can be found here. I (the author) will update it when completed PRs are merged proactively.
Steps to Contribute
- Choose test(s) to work on in the above Google Sheets link
- Check that no on else have claimed the test cases to work on within the last 2 weeks, or that it has been completed by follow up PRs (but not updated in the sheets)
- Comment on this issue to indicate that you'd like to contribute on the chosen test(s). Update your comment if you need more than 2 weeks so that other contributors don't overlap with your work.
- Create a PR to refactor the unit test(s).
- Submit the PR, with a link to this issue by starting the description with "Part of #13304".
- Once all GitHub actions have all passed (or none related to your PR fails), tag me or any other active reviewers and wait for us to review (so that we can get a notification)
Tips
- Understand the access control test methods in
sqlui/webapi/BaseActionTest.java, follow the refactoring in #13254 - Most of the access control testing logic in the migrated unit tests under
sqlui/webapifollows the old unit tests underui/webapi, so you may wish to reference the old unit test for help
Contributions (Last updated 5nd Nov 2025)
Merged
#13254 by @InfinityTwo #13357 by @arnav-goel05
Approved but pending Merge
#13359 by @zedonggg
Ready for/Under Review
#13385 by @Ederich013 #13400 by @MCcoc01
PRs Open
#13373 #13390 #13398 #13401
Good First Issue - Notes for Contributors This issue is for first-time contributors only. If you are new to TEAMMATES, feel free to submit a PR for this issue.
Please note that we allow only one good first issue per contributor. If you have already made a prior contribution to TEAMMATES, you may wish to take a look at issues with the help wanted tag instead.
We do not assign issues to contributors. If you would like to pick up this issue, do post a comment below to express your interest and check if there is anyone else who is already working on the issue. We will do our best to reply and give you the go-ahead, but if we don't, feel free to submit a PR as long as there is no one else working on it.
To get started, do read through our contributing guidelines carefully, and set up a development environment on your local machine before making a PR.
If you need any clarifications on our developer guide, or are facing issues that are not found in our troubleshooting guide, please post a message in our discussion forum.
Hello, I'm new to teammates and would like to take this as my first issue.
Hello, I'm new to teammates and would like to take this as my first issue.
Hi @alextlucas, thanks for wanting to contribute. I would like to suggest that you can consider waiting for my PR to be merged before tackling as there might still be changes after reviews on my PR. Also, do comment which tests you would like to contribute to so that it does not conflict with other developers who wish to contribute as well 😄
@InfinityTwo Sounds good, I will subscribe to the PR and wait for the merge. I can work on rows 38-48 to start, and do more if needed.
Hello. How are you? I'm new to Teammates and I'm very excited to contribute to the project! Since Lucas has already requested lines 38-48, can I start from there? Taking 49 to 59?
Hey @InfinityTwo, would love to contribute to this issue! Was wondering whether I could work on lines 60 to 70?
Hey interested contributors, thanks for your interest and want to help! Feel free to work on whichever rows you want, no permission is required from me. All I ask for is to state which rows you intend to touch on and avoid clashing with others, by giving a 1-2 week grace period. If there are no subsequent PRs linked to this issue within that time, you may tag the previous user who claimed it know you are taking over if you would like to tackle it.
Hi, since the other rows have already been taken, I'd be keen to do lines 71-78. Thank you!
Hi @InfinityTwo, I'm working on lines 49-59.
Hey @InfinityTwo, having some difficulty running the test files to check whether they're passing on IntelliJ. Would be great if u could pls help out.
Hey @InfinityTwo, having some difficulty running the test files to check whether they're passing on IntelliJ. Would be great if u could pls help out.
Hi @arnav-goel05 what issue are you facing?
Hey @InfinityTwo, thanks for getting back to me. I'm not sure how to run the test files in sqlui>webapi. The run button is greyed out for me. Not sure where I'm going wrong.
Hey @InfinityTwo, thanks for getting back to me. I'm not sure how to run the test files in sqlui>webapi. The run button is greyed out for me. Not sure where I'm going wrong.
@arnav-goel05 could you list out the steps you took to run the test files?
My initial guess would be that you might not have installed the project correctly or you might be running an incorrect file by getting confused with the different directories.
The file I'm trying to run is: teammates\src\test\java\teammates\sqlui\webapi\RegenerateInstructorKeyActionTest.java Is this the correct directory? Also, are these files part of the component or E2E tests?
I followed the setup for the project using https://teammates.github.io/teammates/development.html. Is there a particular step I messed up?
The file I'm trying to run is: teammates\src\test\java\teammates\sqlui\webapi\RegenerateInstructorKeyActionTest.java Is this the correct directory? Also, are these files part of the component or E2E tests?
I followed the setup for the project using https://teammates.github.io/teammates/development.html. Is there a particular step I messed up?
@arnav-goel05 these are part of component tests. As for setting up, I don't think so but you can try to reinstall if you would like to.
For me, I just click the play button beside the class/methods to run the tests, select the test that runs component and it should run.
It could also be that you did not set up Intellij configurations properly. Try to change it or clear the cache and restart Intellij.
If you are still unable to debug it, could you send some screenshots and videos of your steps and configurations?
@InfinityTwo Thank u for pointing me towards Intellij configurations. The error seems to be that there isn't any run configurations set up. Could you please help me check with what I'm supposed to put under the Main class for the application config. I'm not able to find a suitable option.
@InfinityTwo Thank u for pointing me towards Intellij configurations. The error seems to be that there isn't any run configurations set up. Could you please help me check with what I'm supposed to put under the Main class for the application config. I'm not able to find a suitable option.
@arnav-goel05 I've pulled a fresh copy of TEAMMATES and opened the folder in Intellij but the run button automatically appears and it is not disabled. I did not install any dependencies or run any commands, and my configurations is empty. From that I am guessing your Intellij is missing something, perhaps Gradle or some other plugins that inhibits the use of testing. You can try adding the missing plugins, reinstall Intellij, or use another editor.
@InfinityTwo Thank u for running on ur end! Reinstalled Intellij and it started working. Wanted to check one last thing, upon running the test files, I got the following error:
No matching tests found in any candidate test task. Requested tests: Test pattern teammates.sqlui.webapi.RegenerateInstructorKeyActionTest.testExecute_successfulRegenerationWithEmailFailed_success in task :architectureTest
Are you getting the same error on your end?
@arnav-goel05 You are running architectureTest which is not the correct test to run. Use componentTest instead (from my memory, use unitTest if it doesn't work). Hope it goes smoothly from here out, happy coding 😃
@arnav-goel05 works for me running unitTests within the test folder in the gradle panel in intellij
@InfinityTwo @zedonggg Thank you so much for helping me out! Its finally running on my end.
@InfinityTwo I've submitted a PR for the test cases (#13353). However, some of the E2E tests are failing ((E2E Sql Tests / E2E-sql-testing (firefox, stable) (pull_request)). Is it necessary for all the test cases for E2E to pass in order to merge the code?
Could you also please review my PR? Thank you!
@arnav-goel05 yes all checks must pass minimally on GitHub Actions. I'll find a time to review after you manage to fix all the issues. Also, if you have any questions regarding your contribution, let's move the conversation over to your PR to avoid overcrowding this issue.
Hi, I would like to work on lines 38-42 on refactoring those tests
@alextlucas hi, do you mind if I pick up on lines 38-48?
Hi all interested contributors (including those before), please note that the rows in the sheets have been modified to include missed files. As such, all rows claimed previously will not correspond to the test you've claimed. Going forward, it would be great if you (including future contributors) state and edit the first and last file names in the rows you want or have claimed. Thanks!
Thank you for the update, I'd love to work on line 50-59 then.
Hi! I would like to contribute from First file name to Last File Name. First file name :- GetFeedbackQuestionsActionTest.java Last File Name. :- GetInstructorsActionTest.java Please Point me if anyone is working on that.
@PriyankaRani34 hello, I'm working on GetFeedbackQuestionsActionTest.java to GetInstructorPrivilegeActionTest.java. Can you work on the line after that?
@hohosznta Sure! Thanks for updating I will take over from GetNotificationActionTest.java to GetUsageStatisticsActionTest.java