Skip to content

Implemented the test suite structure and essential API tests #25

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

Merged
merged 3 commits into from
Jul 31, 2024

Conversation

Yubo-Shao
Copy link
Collaborator

@Yubo-Shao Yubo-Shao commented Jul 30, 2024

Overview
This pull request introduces the general structure for the test suite to the application, implements the basic API unit and functional tests in corresponding packages, and makes some amendments to the existing AppView class. These changes should set a guideline for future test-driven development and provide a basis for extending other functionalities.

Key Changes

  1. Test suite structure
  • Restructured the tests directory with functional and unit sub-directories to provide clearer separation between different types of tests
  • Renaming existing test files to make them automatically collected by running pytest from the root project directory backend.
  1. Debugging and adaptation of some previous tests
  • Adapted existing API tests to the updated config management overhaul.
  • General debugging and conforming of the changes to the new data model, DAO, and AppView.
  1. Current test structure
<Package backend>
  <Package tests>
    <Package functional>
      <Module functional_api_test.py>
        <Function test_sanity_check>
        <Function test_ask_post>
        <Function test_session_get>
        <Function test_session_put>
        <Function test_session_put_failure>
        <Function test_session_delete>
        <Function test_session_delete_failure>
        <Function test_history_get>
        <Function test_history_put>
        <Function test_history_delete>
        <Function test_history_delete_failure>
        <Function test_config_get>
        <Function test_config_get_failure>
        <Function test_config_post>
        <Function test_bots_get>
    <Package unit>
      <Module unit_api_test.py>
        <Function test_sanity_check>
        <Function test_ask_post_no_message>
        <Function test_ask_post_no_bot>
        <Function test_ask_post_success>
        <Function test_session_get_success>
        <Function test_session_put_no_json>
        <Function test_session_put_invalid_json>
        <Function test_session_put_add_success>
        <Function test_session_put_add_failure>
        <Function test_session_delete_no_json>
        <Function test_session_delete_invalid_json>
        <Function test_session_delete_success>
        <Function test_session_delete_failure>
        <Function test_history_get_success>
        <Function test_history_delete_no_json>
        <Function test_history_delete_invalid_json>
        <Function test_history_delete_session_success>
        <Function test_history_delete_session_failure>
        <Function test_config_get_success>
        <Function test_config_get_not_found>
        <Function test_config_post_no_json>
        <Function test_config_post_invalid_json>
        <Function test_bot_get>

Architecture Notes

  • The updated tests allows pytest to run directly through all tests in its sub-directories without specific configuration.
  • Test coverage tools can be easily added based on the new structure.

Potential Work

  • Devs should update their local branches with the new test suite.
  • There are some existing API implementations with insufficient checks on the request body.

Action Required

  • Please test and review these changes for potential issues.
  • Feedback on the current implementation of API tests would be needed.

@Yubo-Shao Yubo-Shao changed the title Adding the test suite structure and implemented the essential API uni… Implemented the test suite structure and essential API tests Jul 30, 2024
@yhbcode000 yhbcode000 added bug Something isn't working testing labels Jul 31, 2024
@yhbcode000
Copy link
Member

image

Copy link
Member

@yhbcode000 yhbcode000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done!

@yhbcode000 yhbcode000 merged commit 563bce9 into main Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working testing
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants