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

feature/BE-39: Backend Unittests [1] #382

Merged
merged 10 commits into from
Dec 25, 2022
Merged

feature/BE-39: Backend Unittests [1] #382

merged 10 commits into from
Dec 25, 2022

Conversation

KarahanS
Copy link
Contributor

As stated in #370, purpose of this PR is to add new unit tests to cover functionalities provided by our APIs. PR includes following additions:

  • Added xmlrunner.extra.djangotestrunner.XMLTestRunner to base.py to generate test output in xml format. Whenever the unittests are run, xml files will be generated and collected in test-output folder. If you are running the tests within the App/backend directory, you can simply call rm test-output/* to clear the content of the folder.
  • Implemented ~45 new unit tests. User RequestFactory to send API requests. You can run all the unittest at once with the following command:
    python manage.py test .
    Additionally, you can run a specific function using the command below:
    python manage.py test -k <name_of_the_function>
    Added these commands to README.
  • Made minor corrections on the documentation as I spot some errors while working on the unittests.
  • Added utils.py to test folder to store some of the common operations - which can be useful for all unittests.

@KarahanS KarahanS added Effort: Low This issue can be easily handled Priority: Medium This issue should be handled, if there isn't any high priority issue Status: Review Needed A review is needed for this issue Coding The issue is related with coding Team: Backend issues related to backend labels Dec 24, 2022
@KarahanS KarahanS self-assigned this Dec 24, 2022
@KarahanS KarahanS mentioned this pull request Dec 24, 2022
7 tasks
@KarahanS KarahanS linked an issue Dec 24, 2022 that may be closed by this pull request
7 tasks
@BElifb
Copy link
Contributor

BElifb commented Dec 25, 2022

  • Ran the tests, they were all successful.
  • Also tried running a single test with the given command, worked as well.
  • One thing to add could be, all of the tests about a specific functionality (e.g. artitem) appeared with the same name in the terminal. I was able to see specific names in the xml files, so this is not absolutely necessary.
  • Thank you for utils.py. Also if you share any of the resources you used while preparing the tests, it would be much appreciated.

@KarahanS
Copy link
Contributor Author

Thanks for the review.

  • Thank you for utils.py. Also if you share any of the resources you used while preparing the tests, it would be much appreciated.

@KarahanS KarahanS merged commit 40867b6 into master Dec 25, 2022
@KarahanS KarahanS deleted the feature/BE-39 branch December 25, 2022 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Coding The issue is related with coding Effort: Low This issue can be easily handled Priority: Medium This issue should be handled, if there isn't any high priority issue Status: Review Needed A review is needed for this issue Team: Backend issues related to backend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BE-39: Backend Unit Tests
2 participants