Skip to content

feat: backend unit test cases: part-I#84

Merged
Roopan-Microsoft merged 30 commits intohotfixfrom
psl-backend-unit-test
Apr 24, 2025
Merged

feat: backend unit test cases: part-I#84
Roopan-Microsoft merged 30 commits intohotfixfrom
psl-backend-unit-test

Conversation

@Prashant-Microsoft
Copy link
Copy Markdown
Contributor

This pull request includes multiple changes aimed at improving test coverage, refactoring code for clarity, and updating dependencies. The changes include workflow updates, database-related improvements, and enhancements to testing infrastructure.

Workflow Updates:

  • Added a new branch trigger (psl-backend-unit-test) in the GitHub Actions workflow to ensure tests run on this branch. (.github/workflows/test.yml)
  • Updated the backend test command to run from the src directory instead of src/tests/backend for better alignment with the project structure. (.github/workflows/test.yml)

Database Improvements:

  • Added # pragma: no cover to abstract methods in DatabaseBase to exclude them from test coverage reporting. (src/backend/common/database/database_base.py) [1] [2]
  • Refactored the main function in database_factory.py for better readability and moved the if __name__ == "__main__" block to the end of the file. (src/backend/common/database/database_factory.py) [1] [2]

Dependency Updates:

  • Updated imports for AzureAIAgent to reflect changes in the semantic_kernel library structure. (src/backend/sql_agents/helpers/agents_manager.py, src/backend/sql_agents/process_batch.py) [1] [2]

Testing Enhancements:

  • Added new unit tests for the backend, including tests for the /health endpoint and backend routes. (src/tests/backend/app_test.py)
  • Replaced unittest with pytest for configuration tests, added fixtures to clear environment variables, and improved test readability. (src/tests/backend/common/config/config_test.py)
  • Introduced a concrete implementation of DatabaseBase for testing and added async test cases for database methods. (src/tests/backend/common/database/database_base_test.py) [1] [2]
  • Mocked configuration and CosmosDB client in database_factory_test.py to isolate tests from external dependencies. (src/tests/backend/common/database/database_factory_test.py)

@Roopan-Microsoft Roopan-Microsoft merged commit fdb0ca1 into hotfix Apr 24, 2025
5 checks passed
@Roopan-Microsoft Roopan-Microsoft deleted the psl-backend-unit-test branch April 24, 2025 13:13
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Ritesh-Microsoft pushed a commit that referenced this pull request Oct 10, 2025
feat:  backend unit test cases: part-I
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants